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 1
1
"use strict" ;
2
2
3
3
var 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" ) ;
6
5
7
6
module . exports = function ( ) {
8
- var match = String ( validFunction ( this ) ) . match ( re ) , fn ;
7
+ validFunction ( this ) ;
9
8
9
+ var args = [ ] ;
10
+ for ( var i = 0 ; i < this . length ; ++ i ) args . push ( "arg" + ( i + 1 ) ) ;
10
11
// eslint-disable-next-line no-new-func
11
- fn = new Function (
12
+ var fn = new Function (
12
13
"fn" ,
13
14
"return function " +
14
- match [ 1 ] . trim ( ) +
15
+ ( this . name || "" ) +
15
16
"(" +
16
- match [ 2 ] +
17
+ args . join ( ", " ) +
17
18
") { return fn.apply(this, arguments); };"
18
19
) ( this ) ;
19
20
try { mixin ( fn , this ) ; }
You can’t perform that action at this time.
0 commit comments