From 77eb1915bbae302a74f9f1e9c096229ad0c2748c Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sat, 10 Feb 2024 11:59:57 +0000 Subject: [PATCH] Auto-generated commit --- to-fancy/lib/ctor.js | 9 +++++---- to-fancy/lib/main.js | 7 +++---- 2 files changed, 8 insertions(+), 8 deletions(-) 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 )