From dc6be1706eba72ab671d8738a4d39c977c9256fb Mon Sep 17 00:00:00 2001 From: Yagiz Nizipli Date: Sat, 19 Nov 2022 14:50:34 -0500 Subject: [PATCH] punycode: fix jsdoc references --- lib/punycode.js | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/lib/punycode.js b/lib/punycode.js index 3483fd667bf40a..bc6bd931cfdaa9 100644 --- a/lib/punycode.js +++ b/lib/punycode.js @@ -60,11 +60,11 @@ function error(type) { * item. * @returns {Array} A new array of values returned by the callback function. */ -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]); } return result; } @@ -76,22 +76,22 @@ function map(array, fn) { * @param {String} domain The domain name or email address. * @param {Function} callback The function that gets called for every * 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 = ''; if (parts.length > 1) { // In email addresses, only the domain name should be punycoded. Leave // the local part (i.e. everything up to `@`) intact. 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; } @@ -140,7 +140,7 @@ function ucs2decode(string) { * @param {Array} codePoints The array of numeric code points. * @returns {String} The new Unicode string (UCS-2). */ -const ucs2encode = array => String.fromCodePoint(...array); +const ucs2encode = codePoints => String.fromCodePoint(...codePoints); /** * Converts a basic code point into a digit/integer.