Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 1 addition & 18 deletions punycode.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,23 +42,6 @@ function error(type) {
throw new RangeError(errors[type]);
}

/**
* A generic `Array#map` utility function.
* @private
* @param {Array} array The array to iterate over.
* @param {Function} callback The function that gets called for every array
* item.
* @returns {Array} A new array of values returned by the callback function.
*/
function map(array, callback) {
const result = [];
let length = array.length;
while (length--) {
result[length] = callback(array[length]);
}
return result;
}

/**
* A simple `Array#map`-like wrapper to work with domain name strings or email
* addresses.
Expand All @@ -81,7 +64,7 @@ function mapDomain(domain, callback) {
// Avoid `split(regex)` for IE8 compatibility. See #17.
domain = domain.replace(regexSeparators, '\x2E');
const labels = domain.split('.');
const encoded = map(labels, callback).join('.');
const encoded = labels.map(callback).join('.');
return result + encoded;
}

Expand Down