Skip to content

Commit 4231bda

Browse files
committed
Auto-generated commit
1 parent 7c90e21 commit 4231bda

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+5552
-63
lines changed

CHANGELOG.md

+26
Original file line numberDiff line numberDiff line change
@@ -328,6 +328,28 @@
328328

329329
<!-- /.package -->
330330

331+
<section class="package" id="ndarray-to-fancy-unreleased">
332+
333+
#### [@stdlib/ndarray/to-fancy](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/ndarray/to-fancy)
334+
335+
<details>
336+
337+
<section class="features">
338+
339+
##### Features
340+
341+
- [`fb1ca76`](https://github.com/stdlib-js/stdlib/commit/fb1ca76ccf2f324c45b24411aa3fd1088a7a7b6e) - add `ndarray/to-fancy`
342+
343+
</section>
344+
345+
<!-- /.features -->
346+
347+
</details>
348+
349+
</section>
350+
351+
<!-- /.package -->
352+
331353
</section>
332354

333355
<!-- /.packages -->
@@ -364,6 +386,10 @@ A total of 3 people contributed to this release. Thank you to the following cont
364386

365387
<details>
366388

389+
- [`0546f39`](https://github.com/stdlib-js/stdlib/commit/0546f395abecb502fd703aa364e758bd733cd18e) - **docs:** disable lint rule _(by Athan Reines)_
390+
- [`5079aa3`](https://github.com/stdlib-js/stdlib/commit/5079aa30f3aa11908c78aac6750b4272852dbb4d) - **docs:** disable lint rule _(by Athan Reines)_
391+
- [`e81185b`](https://github.com/stdlib-js/stdlib/commit/e81185b4a0fa3537ab4a8a16644b7fa90bb184a3) - **refactor:** rely on `ndarray/to-fancy` for implementation logic _(by Athan Reines)_
392+
- [`fb1ca76`](https://github.com/stdlib-js/stdlib/commit/fb1ca76ccf2f324c45b24411aa3fd1088a7a7b6e) - **feat:** add `ndarray/to-fancy` _(by Athan Reines)_
367393
- [`1a202e3`](https://github.com/stdlib-js/stdlib/commit/1a202e3605b10cd01bf9654f8356c72c5c8a8186) - **feat:** update namespace TypeScript declarations [(#3916)](https://github.com/stdlib-js/stdlib/pull/3916) _(by stdlib-bot, Philipp Burckhardt)_
368394
- [`ef82c21`](https://github.com/stdlib-js/stdlib/commit/ef82c2133cc2cb955eb1fc73da0209eda97de59a) - **docs:** update namespace table of contents [(#3918)](https://github.com/stdlib-js/stdlib/pull/3918) _(by stdlib-bot, Philipp Burckhardt)_
369395
- [`14427c7`](https://github.com/stdlib-js/stdlib/commit/14427c79bc62f82b16cbadc9d34749901e48d105) - **feat:** add `fill`, `map`, and `toReversed` to namespace _(by Athan Reines)_

fancy/lib/main.js

+4-39
Original file line numberDiff line numberDiff line change
@@ -25,22 +25,7 @@
2525
var setReadOnly = require( '@stdlib/utils/define-nonenumerable-read-only-property' );
2626
var parent = require( './../../ctor' ); // eslint-disable-line stdlib/no-redeclare
2727
var inherit = require( '@stdlib/utils/inherit' );
28-
var Proxy = require( '@stdlib/proxy/ctor' );
29-
var prop2slice0d = require( './prop2slice.0d.js' );
30-
var prop2slice1d = require( './prop2slice.1d.js' );
31-
var prop2slicend = require( './prop2slice.nd.js' );
32-
var get = require( './get.js' );
33-
var set = require( './set.js' );
34-
35-
36-
// VARIABLES //
37-
38-
var get0d = get( prop2slice0d );
39-
var set0d = set( prop2slice0d );
40-
var get1d = get( prop2slice1d );
41-
var set1d = set( prop2slice1d );
42-
var getnd = get( prop2slicend );
43-
var setnd = set( prop2slicend );
28+
var ndarray2fancy = require( './../../to-fancy' );
4429

4530

4631
// MAIN //
@@ -85,11 +70,7 @@ var setnd = set( prop2slicend );
8570
* // returns <FancyArray>
8671
*/
8772
function FancyArray( dtype, buffer, shape, strides, offset, order, options ) {
88-
var handlers;
89-
var nargs;
90-
var ndims;
91-
92-
nargs = arguments.length;
73+
var nargs = arguments.length;
9374
if ( !( this instanceof FancyArray ) ) {
9475
if ( nargs < 7 ) {
9576
return new FancyArray( dtype, buffer, shape, strides, offset, order );
@@ -99,24 +80,8 @@ function FancyArray( dtype, buffer, shape, strides, offset, order, options ) {
9980
// Call the parent constructor:
10081
parent.call( this, dtype, buffer, shape, strides, offset, order, ( nargs < 7 ) ? {} : options );
10182

102-
if ( Proxy ) { // NOTE: cannot use `@stdlib/assert/has-proxy-support` here, as that API uses code evaluation and might violate CSPs
103-
ndims = shape.length;
104-
handlers = {};
105-
if ( ndims === 0 ) {
106-
handlers.get = get0d;
107-
handlers.set = set0d;
108-
} else if ( ndims === 1 ) {
109-
handlers.get = get1d;
110-
handlers.set = set1d;
111-
} else {
112-
handlers.get = getnd;
113-
handlers.set = setnd;
114-
}
115-
return new Proxy( this, handlers );
116-
}
117-
// TODO: replace with `@stdlib/console/warn` (or equivalent once available)
118-
console.warn( 'WARNING: Proxy objects are not supported in the current environment. Some `FancyArray` functionality may not be available.' ); // eslint-disable-line no-console
119-
return this;
83+
// Proxy the current instance:
84+
return ndarray2fancy( this );
12085
}
12186

12287
// Inherit from the parent constructor:

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@
4747
"@stdlib/math": "github:stdlib-js/math#main",
4848
"@stdlib/number": "github:stdlib-js/number#main",
4949
"@stdlib/object": "github:stdlib-js/object#main",
50-
"@stdlib/proxy": "github:stdlib-js/proxy#main",
5150
"@stdlib/slice": "github:stdlib-js/slice#main",
5251
"@stdlib/string": "github:stdlib-js/string#main",
5352
"@stdlib/symbol": "github:stdlib-js/symbol#main",
@@ -58,6 +57,7 @@
5857
"@stdlib/bench": "github:stdlib-js/bench#main",
5958
"@stdlib/console": "github:stdlib-js/console#main",
6059
"@stdlib/fs": "github:stdlib-js/fs#main",
60+
"@stdlib/proxy": "github:stdlib-js/proxy#main",
6161
"@stdlib/random": "github:stdlib-js/random#main",
6262
"@stdlib/strided": "github:stdlib-js/strided#main",
6363
"@stdlib/time": "github:stdlib-js/time#main",

0 commit comments

Comments
 (0)