Comparing version 2.1.1 to 2.2.0
{ | ||
"name": "punycode", | ||
"version": "2.1.1", | ||
"version": "2.2.0", | ||
"description": "A robust Punycode converter that fully complies to RFC 3492 and RFC 5891, and works on nearly all JavaScript platforms.", | ||
@@ -5,0 +5,0 @@ "homepage": "https://mths.be/punycode", |
@@ -53,7 +53,7 @@ 'use strict'; | ||
*/ | ||
function map(array, fn) { | ||
function map(array, callback) { | ||
const result = []; | ||
let length = array.length; | ||
while (length--) { | ||
result[length] = fn(array[length]); | ||
result[length] = callback(array[length]); | ||
} | ||
@@ -70,7 +70,7 @@ return result; | ||
* character. | ||
* @returns {Array} A new string of characters returned by the callback | ||
* @returns {String} A new string of characters returned by the callback | ||
* function. | ||
*/ | ||
function mapDomain(string, fn) { | ||
const parts = string.split('@'); | ||
function mapDomain(domain, callback) { | ||
const parts = domain.split('@'); | ||
let result = ''; | ||
@@ -81,8 +81,8 @@ if (parts.length > 1) { | ||
result = parts[0] + '@'; | ||
string = parts[1]; | ||
domain = parts[1]; | ||
} | ||
// Avoid `split(regex)` for IE8 compatibility. See #17. | ||
string = string.replace(regexSeparators, '\x2E'); | ||
const labels = string.split('.'); | ||
const encoded = map(labels, fn).join('.'); | ||
domain = domain.replace(regexSeparators, '\x2E'); | ||
const labels = domain.split('.'); | ||
const encoded = map(labels, callback).join('.'); | ||
return result + encoded; | ||
@@ -136,3 +136,3 @@ } | ||
*/ | ||
const ucs2encode = array => String.fromCodePoint(...array); | ||
const ucs2encode = codePoints => String.fromCodePoint(...codePoints); | ||
@@ -349,3 +349,3 @@ /** | ||
} | ||
if (currentValue == n) { | ||
if (currentValue === n) { | ||
// Represent delta as a generalized variable-length integer. | ||
@@ -367,3 +367,3 @@ let q = delta; | ||
output.push(stringFromCharCode(digitToBasic(q, 0))); | ||
bias = adapt(delta, handledCPCountPlusOne, handledCPCount == basicLength); | ||
bias = adapt(delta, handledCPCountPlusOne, handledCPCount === basicLength); | ||
delta = 0; | ||
@@ -370,0 +370,0 @@ ++handledCPCount; |
@@ -53,7 +53,7 @@ 'use strict'; | ||
*/ | ||
function map(array, fn) { | ||
function map(array, callback) { | ||
const result = []; | ||
let length = array.length; | ||
while (length--) { | ||
result[length] = fn(array[length]); | ||
result[length] = callback(array[length]); | ||
} | ||
@@ -70,7 +70,7 @@ return result; | ||
* character. | ||
* @returns {Array} A new string of characters returned by the callback | ||
* @returns {String} A new string of characters returned by the callback | ||
* function. | ||
*/ | ||
function mapDomain(string, fn) { | ||
const parts = string.split('@'); | ||
function mapDomain(domain, callback) { | ||
const parts = domain.split('@'); | ||
let result = ''; | ||
@@ -81,8 +81,8 @@ if (parts.length > 1) { | ||
result = parts[0] + '@'; | ||
string = parts[1]; | ||
domain = parts[1]; | ||
} | ||
// Avoid `split(regex)` for IE8 compatibility. See #17. | ||
string = string.replace(regexSeparators, '\x2E'); | ||
const labels = string.split('.'); | ||
const encoded = map(labels, fn).join('.'); | ||
domain = domain.replace(regexSeparators, '\x2E'); | ||
const labels = domain.split('.'); | ||
const encoded = map(labels, callback).join('.'); | ||
return result + encoded; | ||
@@ -136,3 +136,3 @@ } | ||
*/ | ||
const ucs2encode = array => String.fromCodePoint(...array); | ||
const ucs2encode = codePoints => String.fromCodePoint(...codePoints); | ||
@@ -349,3 +349,3 @@ /** | ||
} | ||
if (currentValue == n) { | ||
if (currentValue === n) { | ||
// Represent delta as a generalized variable-length integer. | ||
@@ -367,3 +367,3 @@ let q = delta; | ||
output.push(stringFromCharCode(digitToBasic(q, 0))); | ||
bias = adapt(delta, handledCPCountPlusOne, handledCPCount == basicLength); | ||
bias = adapt(delta, handledCPCountPlusOne, handledCPCount === basicLength); | ||
delta = 0; | ||
@@ -370,0 +370,0 @@ ++handledCPCount; |
@@ -27,4 +27,8 @@ # Punycode.js [![Build status](https://travis-ci.org/bestiejs/punycode.js.svg?branch=master)](https://travis-ci.org/bestiejs/punycode.js) [![Code coverage status](http://img.shields.io/codecov/c/github/bestiejs/punycode.js.svg)](https://codecov.io/gh/bestiejs/punycode.js) [![Dependency status](https://gemnasium.com/bestiejs/punycode.js.svg)](https://gemnasium.com/bestiejs/punycode.js) | ||
> ⚠️ Note that userland modules don't hide core modules. | ||
> For example, `require('punycode')` still imports the deprecated core module even if you executed `npm install punycode`. | ||
> Use `require('punycode/')` to import userland modules rather than core modules. | ||
```js | ||
const punycode = require('punycode'); | ||
const punycode = require('punycode/'); | ||
``` | ||
@@ -31,0 +35,0 @@ |
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
32776
127