Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

punycode: named anonymous functions #21761

Closed
wants to merge 1 commit into from
Closed
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
14 changes: 7 additions & 7 deletions lib/punycode.js
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ const ucs2encode = array => String.fromCodePoint(...array);
* representing integers) in the range `0` to `base - 1`, or `base` if
* the code point does not represent a value.
*/
const basicToDigit = function(codePoint) {
const basicToDigit = function basicToDigit(codePoint) {
if (codePoint - 0x30 < 0x0A) {
return codePoint - 0x16;
}
Expand All @@ -165,7 +165,7 @@ const basicToDigit = function(codePoint) {
* used; else, the lowercase form is used. The behavior is undefined
* if `flag` is non-zero and `digit` has no uppercase form.
*/
const digitToBasic = function(digit, flag) {
const digitToBasic = function digitToBasic(digit, flag) {
// 0..25 map to ASCII a..z or A..Z
// 26..35 map to ASCII 0..9
return digit + 22 + 75 * (digit < 26) - ((flag != 0) << 5);
Expand All @@ -176,7 +176,7 @@ const digitToBasic = function(digit, flag) {
* https://tools.ietf.org/html/rfc3492#section-3.4
* @private
*/
const adapt = function(delta, numPoints, firstTime) {
const adapt = function adapt(delta, numPoints, firstTime) {
let k = 0;
delta = firstTime ? floor(delta / damp) : delta >> 1;
delta += floor(delta / numPoints);
Expand All @@ -193,7 +193,7 @@ const adapt = function(delta, numPoints, firstTime) {
* @param {String} input The Punycode string of ASCII-only symbols.
* @returns {String} The resulting string of Unicode symbols.
*/
const decode = function(input) {
const decode = function decode(input) {
// Don't use UCS-2.
const output = [];
const inputLength = input.length;
Expand Down Expand Up @@ -284,7 +284,7 @@ const decode = function(input) {
* @param {String} input The string of Unicode symbols.
* @returns {String} The resulting Punycode string of ASCII-only symbols.
*/
const encode = function(input) {
const encode = function encode(input) {
const output = [];

// Convert the input in UCS-2 to an array of Unicode code points.
Expand Down Expand Up @@ -383,7 +383,7 @@ const encode = function(input) {
* @returns {String} The Unicode representation of the given Punycode
* string.
*/
const toUnicode = function(input) {
const toUnicode = function toUnicode(input) {
return mapDomain(input, function(string) {
return regexPunycode.test(string)
? decode(string.slice(4).toLowerCase())
Expand All @@ -402,7 +402,7 @@ const toUnicode = function(input) {
* @returns {String} The Punycode representation of the given domain name or
* email address.
*/
const toASCII = function(input) {
const toASCII = function toASCII(input) {
return mapDomain(input, function(string) {
return regexNonASCII.test(string)
? 'xn--' + encode(string)
Expand Down