File tree Expand file tree Collapse file tree 5 files changed +17
-33
lines changed
Expand file tree Collapse file tree 5 files changed +17
-33
lines changed Original file line number Diff line number Diff line change @@ -385,6 +385,17 @@ function once(callback) {
385385 };
386386}
387387
388+ const ReflectApply = Reflect.apply;
389+
390+ // This function is borrowed from the function with the same name on V8 Extras'
391+ // `utils` object. V8 implements Reflect.apply very efficiently in conjunction
392+ // with the spread syntax, such that no additional special case is needed for
393+ // function calls w/o arguments.
394+ // Refs: https://github.com/v8/v8/blob/d6ead37d265d7215cf9c5f768f279e21bd170212/src/js/prologue.js#L152-L156
395+ function uncurryThis(func) {
396+ return (thisArg, ...args) => ReflectApply(func, thisArg, args);
397+ }
398+
388399module.exports = {
389400 assertCrypto,
390401 cachedResult,
@@ -405,6 +416,7 @@ module.exports = {
405416 promisify,
406417 spliceOne,
407418 removeColors,
419+ uncurryThis,
408420
409421 // Symbol used to customize promisify conversion
410422 customPromisifyArgs: kCustomPromisifyArgsSymbol,
Original file line number Diff line number Diff line change @@ -22,12 +22,7 @@ const {
2222 ONLY_ENUMERABLE
2323 }
2424} = internalBinding('util');
25-
26- const ReflectApply = Reflect.apply;
27-
28- function uncurryThis(func) {
29- return (thisArg, ...args) => ReflectApply(func, thisArg, args);
30- }
25+ const { uncurryThis } = require('internal/util');
3126
3227const kStrict = true;
3328const kLoose = false;
Original file line number Diff line number Diff line change @@ -17,7 +17,8 @@ const {
1717 customInspectSymbol,
1818 isError,
1919 join,
20- removeColors
20+ removeColors,
21+ uncurryThis
2122} = require('internal/util');
2223
2324const {
@@ -63,17 +64,6 @@ const {
6364 isBigUint64Array
6465} = require('internal/util/types');
6566
66- const ReflectApply = Reflect.apply;
67-
68- // This function is borrowed from the function with the same name on V8 Extras'
69- // `utils` object. V8 implements Reflect.apply very efficiently in conjunction
70- // with the spread syntax, such that no additional special case is needed for
71- // function calls w/o arguments.
72- // Refs: https://github.com/v8/v8/blob/d6ead37d265d7215cf9c5f768f279e21bd170212/src/js/prologue.js#L152-L156
73- function uncurryThis(func) {
74- return (thisArg, ...args) => ReflectApply(func, thisArg, args);
75- }
76-
7767const propertyIsEnumerable = uncurryThis(Object.prototype.propertyIsEnumerable);
7868const regExpToString = uncurryThis(RegExp.prototype.toString);
7969const dateToISOString = uncurryThis(Date.prototype.toISOString);
Original file line number Diff line number Diff line change 11'use strict';
22
3- const ReflectApply = Reflect.apply;
4-
5- // This function is borrowed from the function with the same name on V8 Extras'
6- // `utils` object. V8 implements Reflect.apply very efficiently in conjunction
7- // with the spread syntax, such that no additional special case is needed for
8- // function calls w/o arguments.
9- // Refs: https://github.com/v8/v8/blob/d6ead37d265d7215cf9c5f768f279e21bd170212/src/js/prologue.js#L152-L156
10- function uncurryThis(func) {
11- return (thisArg, ...args) => ReflectApply(func, thisArg, args);
12- }
3+ const { uncurryThis } = require('internal/util');
134
145const TypedArrayPrototype = Object.getPrototypeOf(Uint8Array.prototype);
156
Original file line number Diff line number Diff line change @@ -42,13 +42,9 @@ const {
4242 deprecate,
4343 getSystemErrorName: internalErrorName,
4444 promisify,
45+ uncurryThis
4546} = require('internal/util');
4647
47- const ReflectApply = Reflect.apply;
48-
49- function uncurryThis(func) {
50- return (thisArg, ...args) => ReflectApply(func, thisArg, args);
51- }
5248const objectToString = uncurryThis(Object.prototype.toString);
5349
5450let internalDeepEqual;
You can’t perform that action at this time.
0 commit comments