endpoints/endpoints

View on GitHub
es5/controller/lib/single_slash_join.js

Summary

Maintainability
A
0 mins
Test Coverage
'use strict';

exports.__esModule = true;

exports['default'] = function () {
  var input = arguments.length <= 0 || arguments[0] === undefined ? [] : arguments[0];

  if (!Array.isArray(input)) {
    throw new Error('Input must be an array.');
  }
  return '/' + input.join('/').replace(/^\/+|\/+$|(\/)+/g, '$1');
};

module.exports = exports['default'];