File tree 1 file changed +5
-11
lines changed
1 file changed +5
-11
lines changed Original file line number Diff line number Diff line change 12
12
// `primordials.Object` where `primordials` is a lexical variable passed
13
13
// by the native module compiler.
14
14
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 ) ;
26
20
primordials . uncurryThis = uncurryThis ;
27
21
28
22
function copyProps ( src , dest ) {
You can’t perform that action at this time.
0 commit comments