postman-url-encoder
Advanced tools
Comparing version 3.0.3 to 3.0.4
@@ -47,3 +47,3 @@ /** | ||
const url = require('url'), | ||
const domainToASCII = require('url').domainToASCII, | ||
@@ -73,35 +73,4 @@ encodeSet = require('./encode-set'), | ||
PATH_SEPARATOR = '/', | ||
DOMAIN_SEPARATOR = '.', | ||
DOMAIN_SEPARATOR = '.'; | ||
/** | ||
* Returns the Punycode ASCII serialization of the domain. | ||
* | ||
* @note `url.domainToASCII` returns empty string for invalid domain. | ||
* | ||
* @todo Remove `punycode` dependency on Node version >= 6.13.0. | ||
* For backward compatibility, fallback to `punycode` as url.domainToASCII. | ||
* | ||
* @private | ||
* @function | ||
* @param {String} domain domain name | ||
* @returns {String} punycode encoded domain name | ||
*/ | ||
domainToASCII = (function () { | ||
const domainToASCII = url.domainToASCII; | ||
// @note In Electron v3.1.8, the Node.js native url.domainToASCII | ||
// doesn't work as expected. ¯\_(ツ)_/¯ | ||
// so, check if it convert's '😎' to 'xn--s28h' or not. | ||
// @todo Remove this hack on Electron >= 4 | ||
/* istanbul ignore next */ | ||
if (typeof domainToASCII === 'function' && domainToASCII('😎') === 'xn--s28h') { | ||
// use faster native method | ||
return domainToASCII; | ||
} | ||
// else, lazy load `punycode` dependency | ||
/* istanbul ignore next */ | ||
return require('punycode').toASCII; | ||
}()); | ||
/** | ||
@@ -108,0 +77,0 @@ * Returns the Punycode ASCII serialization of the domain. |
{ | ||
"name": "postman-url-encoder", | ||
"version": "3.0.3", | ||
"version": "3.0.4", | ||
"description": "Implementation of the WHATWG URL Standard", | ||
@@ -33,16 +33,13 @@ "author": "Postman Inc.", | ||
}, | ||
"dependencies": { | ||
"punycode": "^2.1.1" | ||
}, | ||
"devDependencies": { | ||
"@postman/csv-parse": "^4.0.2", | ||
"@postman/shipit": "^0.3.0", | ||
"async": "^3.1.1", | ||
"async": "^3.2.1", | ||
"bipbip": "^0.4.2", | ||
"chai": "^4.3.4", | ||
"chalk": "^4.1.1", | ||
"chalk": "^4.1.2", | ||
"colors": "^1.4.0", | ||
"editorconfig": "^0.15.3", | ||
"eslint": "^7.30.0", | ||
"eslint-plugin-jsdoc": "^35.4.3", | ||
"eslint": "^7.32.0", | ||
"eslint-plugin-jsdoc": "^36.0.6", | ||
"eslint-plugin-lodash": "^7.2.0", | ||
@@ -52,6 +49,6 @@ "eslint-plugin-mocha": "^9.0.0", | ||
"jsdoc": "^3.6.7", | ||
"mocha": "^9.0.2", | ||
"mocha": "^9.0.3", | ||
"nyc": "^15.1.0", | ||
"parse-gitignore": "^1.0.1", | ||
"postman-collection": "^4.0.0", | ||
"postman-collection": "^4.0.1", | ||
"postman-jsdoc-theme": "^0.0.3", | ||
@@ -58,0 +55,0 @@ "recursive-readdir": "^2.2.2", |
@@ -161,3 +161,2 @@ /** | ||
pointer = 0, | ||
protocol, | ||
_length, | ||
@@ -206,3 +205,3 @@ length, | ||
// extract from the front | ||
url.protocol.value = protocol = urlString.slice(0, index); | ||
url.protocol.value = urlString.slice(0, index); | ||
url.protocol.beginIndex = pointer; | ||
@@ -214,16 +213,16 @@ url.protocol.endIndex = pointer + index; | ||
pointer += index + 3; | ||
} | ||
// special handling for leading slashes e.g, http:///example.com | ||
_length = length; // length with leading slashes | ||
// special handling for extra slashes in protocol e.g, http:///example.com | ||
_length = length; // length with leading slashes | ||
urlString = urlString.replace(REGEX_LEADING_SLASHES, | ||
(protocol && protocol.toLowerCase() === FILE_PROTOCOL) ? | ||
// file:////path -> file:///path | ||
PATH_SEPARATOR : | ||
// protocol:////host/path -> protocol://host/path | ||
E); | ||
urlString = urlString.replace(REGEX_LEADING_SLASHES, | ||
(url.protocol.value.toLowerCase() === FILE_PROTOCOL) ? | ||
// file:////path -> file:///path | ||
PATH_SEPARATOR : | ||
// protocol:////host/path -> protocol://host/path | ||
E); | ||
length = urlString.length; // length without slashes | ||
pointer += _length - length; // update pointer | ||
length = urlString.length; // length without slashes | ||
pointer += _length - length; // update pointer | ||
} | ||
@@ -230,0 +229,0 @@ // 4. url.path |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
0
72267
1678
- Removedpunycode@^2.1.1
- Removedpunycode@2.3.1(transitive)