File tree Expand file tree Collapse file tree 2 files changed +8
-8
lines changed Expand file tree Collapse file tree 2 files changed +8
-8
lines changed Original file line number Diff line number Diff line change 24
24
* Returns a trap for constructing new array instances.
25
25
*
26
26
* @private
27
- * @param {Object } ctx - context object
28
- * @param {Function } ctx.array2fancy - function for creating a proxied array
27
+ * @param {Function } array2fancy - function for creating a proxied array
28
+ * @param {Object } opts - options
29
+ * @param {boolean } opts.strict - boolean indicating whether to perform strict bounds checking
29
30
* @returns {Function } handler
30
31
*/
31
- function factory ( ctx ) {
32
+ function factory ( array2fancy , opts ) {
32
33
return constructor ;
33
34
34
35
/**
@@ -83,7 +84,7 @@ function factory( ctx ) {
83
84
// Fallback to using `apply`; however, some constructors may error if the constructor is not callable (i.e., if a constructor always requires `new`):
84
85
x = target . apply ( null , a ) ;
85
86
}
86
- return ctx . array2fancy ( x ) ;
87
+ return array2fancy ( x , opts ) ;
87
88
}
88
89
}
89
90
Original file line number Diff line number Diff line change @@ -98,11 +98,10 @@ function array2fancy( x ) {
98
98
'strict' : opts . strict ,
99
99
'validator' : validator ( dt ) ,
100
100
'array2fancy' : array2fancy ,
101
- 'ctor' : null
101
+ 'ctor' : new Proxy ( x . constructor || Array , {
102
+ 'construct' : ctor ( array2fancy , opts )
103
+ } )
102
104
} ;
103
- o . ctor = new Proxy ( x . constructor || Array , {
104
- 'construct' : ctor ( o )
105
- } ) ;
106
105
return new Proxy ( x , {
107
106
'get' : get ( o ) ,
108
107
'set' : set ( o )
You can’t perform that action at this time.
0 commit comments