Skip to content

Commit 77eb191

Browse files
committed
Auto-generated commit
1 parent 43ea7cb commit 77eb191

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

to-fancy/lib/ctor.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,12 @@
2424
* Returns a trap for constructing new array instances.
2525
*
2626
* @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
2930
* @returns {Function} handler
3031
*/
31-
function factory( ctx ) {
32+
function factory( array2fancy, opts ) {
3233
return constructor;
3334

3435
/**
@@ -83,7 +84,7 @@ function factory( ctx ) {
8384
// Fallback to using `apply`; however, some constructors may error if the constructor is not callable (i.e., if a constructor always requires `new`):
8485
x = target.apply( null, a );
8586
}
86-
return ctx.array2fancy( x );
87+
return array2fancy( x, opts );
8788
}
8889
}
8990

to-fancy/lib/main.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -98,11 +98,10 @@ function array2fancy( x ) {
9898
'strict': opts.strict,
9999
'validator': validator( dt ),
100100
'array2fancy': array2fancy,
101-
'ctor': null
101+
'ctor': new Proxy( x.constructor || Array, {
102+
'construct': ctor( array2fancy, opts )
103+
})
102104
};
103-
o.ctor = new Proxy( x.constructor || Array, {
104-
'construct': ctor( o )
105-
});
106105
return new Proxy( x, {
107106
'get': get( o ),
108107
'set': set( o )

0 commit comments

Comments
 (0)