Skip to content

Commit

Permalink
Auto-generated commit
Browse files Browse the repository at this point in the history
  • Loading branch information
stdlib-bot committed Feb 10, 2024
1 parent 43ea7cb commit 77eb191
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
9 changes: 5 additions & 4 deletions to-fancy/lib/ctor.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;

/**
Expand Down Expand Up @@ -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 );
}
}

Expand Down
7 changes: 3 additions & 4 deletions to-fancy/lib/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 )
Expand Down

0 comments on commit 77eb191

Please sign in to comment.