File tree Expand file tree Collapse file tree 1 file changed +5
-11
lines changed Expand file tree Collapse file tree 1 file changed +5
-11
lines changed Original file line number Diff line number Diff line change 1212// `primordials.Object` where `primordials` is a lexical variable passed
1313// by the native module compiler.
1414
15- const ReflectApply = Reflect . apply ;
16-
17- // This function is borrowed from the function with the same name on V8 Extras'
18- // `utils` object. V8 implements Reflect.apply very efficiently in conjunction
19- // with the spread syntax, such that no additional special case is needed for
20- // function calls w/o arguments.
21- // Refs: https://github.com/v8/v8/blob/d6ead37d265d7215cf9c5f768f279e21bd170212/src/js/prologue.js#L152-L156
22- function uncurryThis ( func ) {
23- return ( thisArg , ...args ) => ReflectApply ( func , thisArg , args ) ;
24- }
25-
15+ // `uncurryThis` is equivalent to `func => Function.prototype.call.bind(func)`.
16+ // It is using `call.bind(bind, call)` to avoid using `Function.prototype.bind`
17+ // after it may have been mutated by users.
18+ const { bind, call } = Function . prototype ;
19+ const uncurryThis = call . bind ( bind , call ) ;
2620primordials . uncurryThis = uncurryThis ;
2721
2822function copyProps ( src , dest ) {
You can’t perform that action at this time.
0 commit comments