tough-cookie
Advanced tools
Comparing version 5.1.0-rc.0 to 5.1.0
@@ -5,4 +5,11 @@ "use strict"; | ||
const constants_1 = require("./constants"); | ||
const node_url_1 = require("node:url"); | ||
/** | ||
* Normalizes a domain to lowercase and punycode-encoded. | ||
* Runtime-agnostic equivalent to node's `domainToASCII`. | ||
* @see https://nodejs.org/docs/latest-v22.x/api/url.html#urldomaintoasciidomain | ||
*/ | ||
function domainToASCII(domain) { | ||
return new URL(`http://${domain}`).hostname; | ||
} | ||
/** | ||
* Transforms a domain name into a canonical domain name. The canonical domain name is a domain name | ||
@@ -50,3 +57,3 @@ * that has been trimmed, lowercased, stripped of leading dot, and optionally punycode-encoded | ||
} | ||
return (0, node_url_1.domainToASCII)(str).slice(1, -1); // remove [ and ] | ||
return domainToASCII(str).slice(1, -1); // remove [ and ] | ||
} | ||
@@ -56,3 +63,3 @@ // convert to IDN if any non-ASCII characters | ||
if (/[^\u0001-\u007f]/.test(str)) { | ||
return (0, node_url_1.domainToASCII)(str); | ||
return domainToASCII(str); | ||
} | ||
@@ -59,0 +66,0 @@ // ASCII-only domain - not canonicalized with new URL() because it may be a malformed URL |
@@ -5,2 +5,2 @@ /** | ||
*/ | ||
export declare const version = "5.1.0-rc.0"; | ||
export declare const version = "5.1.0"; |
@@ -8,2 +8,2 @@ "use strict"; | ||
*/ | ||
exports.version = '5.1.0-rc.0'; | ||
exports.version = '5.1.0'; |
@@ -78,3 +78,3 @@ { | ||
], | ||
"version": "5.1.0-rc.0", | ||
"version": "5.1.0", | ||
"homepage": "https://github.com/salesforce/tough-cookie", | ||
@@ -81,0 +81,0 @@ "repository": { |
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
227531
5126
0