diff --git a/lib/internal/readline/utils.js b/lib/internal/readline/utils.js index 124a5382a0ddae..4a6845af4241da 100644 --- a/lib/internal/readline/utils.js +++ b/lib/internal/readline/utils.js @@ -1,8 +1,7 @@ 'use strict'; const { - ArrayPrototypeSlice, - ArrayPrototypeSort, + ArrayPrototypeToSorted, RegExpPrototypeExec, StringFromCharCode, StringPrototypeCharCodeAt, @@ -385,7 +384,7 @@ function commonPrefix(strings) { if (strings.length === 1) { return strings[0]; } - const sorted = ArrayPrototypeSort(ArrayPrototypeSlice(strings)); + const sorted = ArrayPrototypeToSorted(strings); const min = sorted[0]; const max = sorted[sorted.length - 1]; for (let i = 0; i < min.length; i++) { diff --git a/typings/primordials.d.ts b/typings/primordials.d.ts index ce6ca86f3e633d..e5426b85b5c29b 100644 --- a/typings/primordials.d.ts +++ b/typings/primordials.d.ts @@ -128,6 +128,7 @@ declare namespace primordials { export const ArrayPrototypeSlice: UncurryThis export const ArrayPrototypeSort: UncurryThis export const ArrayPrototypeSplice: UncurryThis + export const ArrayPrototypeToSorted: UncurryThis export const ArrayPrototypeIncludes: UncurryThis export const ArrayPrototypeIndexOf: UncurryThis export const ArrayPrototypeJoin: UncurryThis