diff --git a/to-fancy/lib/ctor.js b/to-fancy/lib/ctor.js index 7af31b1a..03d627b9 100644 --- a/to-fancy/lib/ctor.js +++ b/to-fancy/lib/ctor.js @@ -24,11 +24,12 @@ * Returns a trap for constructing new array instances. * * @private -* @param {Object} ctx - context object -* @param {Function} ctx.array2fancy - function for creating a proxied array +* @param {Function} array2fancy - function for creating a proxied array +* @param {Object} opts - options +* @param {boolean} opts.strict - boolean indicating whether to perform strict bounds checking * @returns {Function} handler */ -function factory( ctx ) { +function factory( array2fancy, opts ) { return constructor; /** @@ -83,7 +84,7 @@ function factory( ctx ) { // Fallback to using `apply`; however, some constructors may error if the constructor is not callable (i.e., if a constructor always requires `new`): x = target.apply( null, a ); } - return ctx.array2fancy( x ); + return array2fancy( x, opts ); } } diff --git a/to-fancy/lib/main.js b/to-fancy/lib/main.js index c7184757..3fe0bca8 100644 --- a/to-fancy/lib/main.js +++ b/to-fancy/lib/main.js @@ -98,11 +98,10 @@ function array2fancy( x ) { 'strict': opts.strict, 'validator': validator( dt ), 'array2fancy': array2fancy, - 'ctor': null + 'ctor': new Proxy( x.constructor || Array, { + 'construct': ctor( array2fancy, opts ) + }) }; - o.ctor = new Proxy( x.constructor || Array, { - 'construct': ctor( o ) - }); return new Proxy( x, { 'get': get( o ), 'set': set( o )