diff options
| author | ruki <waruqi@gmail.com> | 2018-11-08 00:43:05 +0800 |
|---|---|---|
| committer | ruki <waruqi@gmail.com> | 2018-11-07 22:18:30 +0800 |
| commit | 89e95b3f143682ed9a006991bacf45c9dcba4818 (patch) | |
| tree | 4f44cf41b828577d583890bdd5a1c31e8491a6ba /node_modules/url-join/lib/url-join.js | |
| parent | aa7f0199255277949790b41c56e8ec97dd4f0da4 (diff) | |
| download | xmake-docs-vuepress.tar.gz xmake-docs-vuepress.zip | |
remove node_modulesvuepress
Diffstat (limited to 'node_modules/url-join/lib/url-join.js')
| -rw-r--r-- | node_modules/url-join/lib/url-join.js | 77 |
1 files changed, 0 insertions, 77 deletions
diff --git a/node_modules/url-join/lib/url-join.js b/node_modules/url-join/lib/url-join.js deleted file mode 100644 index ed88c8f4..00000000 --- a/node_modules/url-join/lib/url-join.js +++ /dev/null @@ -1,77 +0,0 @@ -(function (name, context, definition) { - if (typeof module !== 'undefined' && module.exports) module.exports = definition(); - else if (typeof define === 'function' && define.amd) define(definition); - else context[name] = definition(); -})('urljoin', this, function () { - - function startsWith(str, searchString) { - return str.substr(0, searchString.length) === searchString; - } - - function normalize (strArray, options) { - var resultArray = []; - - // If the first part is a plain protocol, we combine it with the next part. - if (strArray[0].match(/^[^/:]+:\/*$/) && strArray.length > 1) { - var first = strArray.shift(); - strArray[0] = first + strArray[0]; - } - - // There must be two or three slashes in the file protocol, two slashes in anything else. - if (strArray[0].match(/^file:\/\/\//)) { - strArray[0] = strArray[0].replace(/^([^/:]+):\/*/, '$1:///'); - } else { - strArray[0] = strArray[0].replace(/^([^/:]+):\/*/, '$1://'); - } - - for (var i = 0; i < strArray.length; i++) { - - var component = strArray[i]; - - if (typeof component !== 'string') { - component = component && component.toString() || ''; - } - - if (i > 0) { - // Removing the starting slashes for each component but the first. - component = component.replace(/^[\/]+/, ''); - } - if (i < strArray.length - 1) { - // Removing the ending slashes for each component but the last. - component = component.replace(/[\/]+$/, ''); - } else { - // For the last component we will combine multiple slashes to a single one. - component = component.replace(/[\/]+$/, '/'); - } - - resultArray.push(component); - - } - - var str = resultArray.join('/'); - // Each input component is now separated by a single slash except the possible first plain protocol part. - - // remove trailing slash before parameters or hash - str = str.replace(/\/(\?|&|#[^!])/g, '$1'); - - // replace ? in parameters with & - var parts = str.split('?'); - str = parts.shift() + (parts.length > 0 ? '?': '') + parts.join('&'); - - return str; - } - - return function () { - var input = arguments; - var options = {}; - - if (typeof arguments[0] === 'object') { - // new syntax with array and options - input = arguments[0]; - options = arguments[1] || {}; - } - - return normalize([].slice.call(input), options); - }; - -}); |
