File tree Expand file tree Collapse file tree 1 file changed +7
-6
lines changed
Expand file tree Collapse file tree 1 file changed +7
-6
lines changed Original file line number Diff line number Diff line change 11"use strict" ;
22
33var mixin = require ( "../../object/mixin" )
4- , validFunction = require ( "../valid-function" )
5- , re = / ^ \s * f u n c t i o n \s * ( [ \0 - ' ) - \uffff ] + ) * \s * \( ( [ \0 - ( * - \uffff ] * ) \) \s * \{ / ;
4+ , validFunction = require ( "../valid-function" ) ;
65
76module . exports = function ( ) {
8- var match = String ( validFunction ( this ) ) . match ( re ) , fn ;
7+ validFunction ( this ) ;
98
9+ var args = [ ] ;
10+ for ( var i = 0 ; i < this . length ; ++ i ) args . push ( "arg" + ( i + 1 ) ) ;
1011 // eslint-disable-next-line no-new-func
11- fn = new Function (
12+ var fn = new Function (
1213 "fn" ,
1314 "return function " +
14- match [ 1 ] . trim ( ) +
15+ ( this . name || "" ) +
1516 "(" +
16- match [ 2 ] +
17+ args . join ( ", " ) +
1718 ") { return fn.apply(this, arguments); };"
1819 ) ( this ) ;
1920 try { mixin ( fn , this ) ; }
You can’t perform that action at this time.
0 commit comments