@stdlib/array-to-fancy 0.1.0 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -231,6 +231,19 @@ var v = y[ 10 ];
231
231
 
232
232
  The returned function supports the same options as above. When the returned function is provided option values, those values override the factory method defaults.
233
233
 
234
+ #### array2fancy.idx( x\[, options] )
235
+
236
+ Wraps a provided array as an array index object.
237
+
238
+ ```javascript
239
+ var x = [ 1, 2, 3, 4 ];
240
+
241
+ var idx = array2fancy.idx( x );
242
+ // returns <ArrayIndex>
243
+ ```
244
+
245
+ For documentation and usage, see [`ArrayIndex`][@stdlib/array/index].
246
+
234
247
  </section>
235
248
 
236
249
  <!-- /.usage -->
@@ -259,8 +272,6 @@ Accordingly, when `strict` is `false`, one may observe the following behaviors:
259
272
  <!-- run throws: true -->
260
273
 
261
274
  ```javascript
262
- var idx = require( '@stdlib/array-index' );
263
-
264
275
  var x = array2fancy( [ 1, 2, 3, 4 ], {
265
276
  'strict': false
266
277
  });
@@ -281,7 +292,8 @@ v = x[ '10:' ];
281
292
  // returns []
282
293
 
283
294
  // Access one or more out-of-bounds indices:
284
- v = x[ idx( [ 10, 20 ] ) ];
295
+ var i = array2fancy.idx( [ 10, 20 ] );
296
+ v = x[ i ];
285
297
  // throws <RangeError>
286
298
  ```
287
299
 
@@ -290,8 +302,6 @@ When `strict` is `true`, fancy arrays normalize index behavior and consistently
290
302
  <!-- run throws: true -->
291
303
 
292
304
  ```javascript
293
- var idx = require( '@stdlib/array-index' );
294
-
295
305
  var x = array2fancy( [ 1, 2, 3, 4 ], {
296
306
  'strict': true
297
307
  });
@@ -312,7 +322,8 @@ v = x[ '10:' ];
312
322
  // throws <RangeError>
313
323
 
314
324
  // Access one or more out-of-bounds indices:
315
- v = x[ idx( [ 10, 20 ] ) ];
325
+ var i = array2fancy.idx( [ 10, 20 ] );
326
+ v = x[ i ];
316
327
  // throws <RangeError>
317
328
  ```
318
329
 
@@ -384,6 +395,24 @@ y[ '10:20' ] = [ 8, 9, 10, 11 ];
384
395
  // throws <Error>
385
396
  ```
386
397
 
398
+ In order to broadcast a nested array element as one would a scalar, one must wrap the element in a single-element array.
399
+
400
+ ```javascript
401
+ var y = array2fancy( [ [ 1, 2 ], [ 3, 4 ] ] );
402
+
403
+ // Assign individual array elements:
404
+ y[ ':' ] = [ 5, 6 ];
405
+ var v = y[ ':' ];
406
+ // returns [ 5, 6 ]
407
+
408
+ y = array2fancy( [ [ 1, 2 ], [ 3, 4 ] ] );
409
+
410
+ // Broadcast a nested array:
411
+ y[ ':' ] = [ [ 5, 6 ] ];
412
+ v = y[ ':' ];
413
+ // returns [ [ 5, 6 ], [ 5, 6 ] ]
414
+ ```
415
+
387
416
  ### Casting
388
417
 
389
418
  Fancy arrays support [(mostly) safe casts][@stdlib/array/mostly-safe-casts] (i.e., any cast which can be performed without overflow or loss of precision, with the exception of floating-point arrays which are also allowed to downcast from higher precision to lower precision).
@@ -422,8 +451,8 @@ When assigning a real-valued scalar to a complex number array (e.g., [`Complex12
422
451
 
423
452
  ```javascript
424
453
  var Complex128Array = require( '@stdlib/array-complex128' );
425
- var real = require( '@stdlib/complex-real' );
426
- var imag = require( '@stdlib/complex-imag' );
454
+ var real = require( '@stdlib/complex-float64-real' );
455
+ var imag = require( '@stdlib/complex-float64-imag' );
427
456
 
428
457
  var x = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] );
429
458
  var y = array2fancy( x );
@@ -468,7 +497,7 @@ im = imag( v );
468
497
  ```javascript
469
498
  var Uint8Array = require( '@stdlib/array-uint8' );
470
499
  var Int32Array = require( '@stdlib/array-int32' );
471
- var idx = require( '@stdlib/array-index' );
500
+ var BooleanArray = require( '@stdlib/array-bool' );
472
501
  var array2fancy = require( '@stdlib/array-to-fancy' );
473
502
 
474
503
  var x = [ 1, 2, 3, 4, 5, 6 ];
@@ -495,6 +524,8 @@ z = y[ ':' ];
495
524
  // returns [ 1, 2, -10, -9, -8, 6 ]
496
525
 
497
526
  // Array index retrieval:
527
+ var idx = array2fancy.idx;
528
+
498
529
  var i = idx( [ 1, 3, 4 ] ); // integer index array
499
530
  z = y[ i ];
500
531
  // returns [ 2, -9, -8 ]
@@ -503,6 +534,10 @@ i = idx( [ true, false, false, true, true, true ] ); // boolean array
503
534
  z = y[ i ];
504
535
  // returns [ 1, -9, -8, 6 ]
505
536
 
537
+ i = idx( new BooleanArray( [ true, false, false, true, true, true ] ) ); // boolean array
538
+ z = y[ i ];
539
+ // returns [ 1, -9, -8, 6 ]
540
+
506
541
  i = idx( new Uint8Array( [ 0, 0, 1, 0, 0, 1 ] ) ); // mask array
507
542
  z = y[ i ];
508
543
  // returns [ 1, 2, -9, -8 ]
@@ -510,6 +545,35 @@ z = y[ i ];
510
545
  i = idx( new Int32Array( [ 0, 0, 1, 1, 2, 2 ] ) ); // integer index array
511
546
  z = y[ i ];
512
547
  // returns [ 1, 1, 2, 2, -10, -10 ]
548
+
549
+ // Array index assignment:
550
+ x = [ 1, 2, 3, 4, 5, 6 ];
551
+ y = array2fancy( x );
552
+
553
+ i = idx( [ true, false, true, false, true, false ] ); // boolean array
554
+ y[ i ] = 5;
555
+ z = y[ ':' ];
556
+ // returns [ 5, 2, 5, 4, 5, 6 ]
557
+
558
+ i = idx( new BooleanArray( [ true, false, true, false, true, false ] ) ); // boolean array
559
+ y[ i ] = 7;
560
+ z = y[ ':' ];
561
+ // returns [ 7, 2, 7, 4, 7, 6 ]
562
+
563
+ i = idx( new Uint8Array( [ 1, 1, 1, 0, 0, 0 ] ) ); // mask array
564
+ y[ i ] = 8;
565
+ z = y[ ':' ];
566
+ // returns [ 7, 2, 7, 8, 8, 8 ]
567
+
568
+ i = idx( new Int32Array( [ 5, 3, 2 ] ) ); // integer index array
569
+ y[ i ] = [ 9, 10, 11 ];
570
+ z = y[ ':' ];
571
+ // returns [ 7, 2, 11, 10, 8, 9 ]
572
+
573
+ i = idx( [ 0, 1 ] ); // integer index array
574
+ y[ i ] = -1;
575
+ z = y[ ':' ];
576
+ // returns [ -1, -1, 11, 10, 8, 9 ]
513
577
  ```
514
578
 
515
579
  </section>
@@ -578,8 +642,8 @@ Copyright &copy; 2016-2024. The Stdlib [Authors][stdlib-authors].
578
642
  [npm-image]: http://img.shields.io/npm/v/@stdlib/array-to-fancy.svg
579
643
  [npm-url]: https://npmjs.org/package/@stdlib/array-to-fancy
580
644
 
581
- [test-image]: https://github.com/stdlib-js/array-to-fancy/actions/workflows/test.yml/badge.svg?branch=v0.1.0
582
- [test-url]: https://github.com/stdlib-js/array-to-fancy/actions/workflows/test.yml?query=branch:v0.1.0
645
+ [test-image]: https://github.com/stdlib-js/array-to-fancy/actions/workflows/test.yml/badge.svg?branch=v0.2.0
646
+ [test-url]: https://github.com/stdlib-js/array-to-fancy/actions/workflows/test.yml?query=branch:v0.2.0
583
647
 
584
648
  [coverage-image]: https://img.shields.io/codecov/c/github/stdlib-js/array-to-fancy/main.svg
585
649
  [coverage-url]: https://codecov.io/github/stdlib-js/array-to-fancy?branch=main
package/dist/index.js CHANGED
@@ -1,57 +1,59 @@
1
- "use strict";var u=function(r,i){return function(){return i||r((i={exports:{}}).exports,i),i.exports}};var b=u(function(It,E){
2
- var Ir=require('@stdlib/array-base-assert-is-complex-floating-point-data-type/dist'),Ar=require('@stdlib/assert-is-number/dist').isPrimitive;function Tr(r){return Ar(r)?[r,0]:r}function xr(r){return Ir(r)?Tr:null}E.exports=xr
3
- });var I=u(function(At,S){
4
- function Rr(r,i){return a;function a(t){return r(t,i)}}S.exports=Rr
5
- });var T=u(function(Tt,A){
6
- var Dr=require('@stdlib/proxy-ctor/dist'),kr=typeof Dr=="function";A.exports=kr
7
- });var R=u(function(xt,x){
8
- var _r=require('@stdlib/array-index/dist');function Pr(){return{cache:_r,strict:!1}}x.exports=Pr
9
- });var _=u(function(Rt,k){
10
- var Nr=require('@stdlib/assert-is-plain-object/dist'),D=require('@stdlib/assert-has-own-property/dist'),Vr=require('@stdlib/assert-is-boolean/dist').isPrimitive,Ur=require('@stdlib/assert-is-method-in/dist'),y=require('@stdlib/error-tools-fmtprodmsg/dist');function Cr(r,i){return Nr(i)?D(i,"strict")&&(r.strict=i.strict,!Vr(r.strict))?new TypeError(y('1rX2o',"strict",r.strict)):D(i,"cache")&&(r.cache=i.cache,!Ur(r.cache,"get"))?new TypeError(y("invalid option. `%s` option is missing a `%s` method. Option: `%s`.","cache","get",r.cache)):null:new TypeError(y('1rX2V',i));}k.exports=Cr
11
- });var U=u(function(Dt,V){
12
- var l=require('@stdlib/assert-is-number/dist').isPrimitive,Or=require('@stdlib/assert-is-integer/dist').isPrimitive,f=require('@stdlib/assert-is-complex-like/dist'),Gr=require('@stdlib/array-base-assert-is-real-floating-point-data-type/dist'),Fr=require('@stdlib/array-base-assert-is-unsigned-integer-data-type/dist'),Lr=require('@stdlib/array-base-assert-is-signed-integer-data-type/dist'),P=require('@stdlib/array-base-assert-is-safe-data-type-cast/dist'),N=require('@stdlib/array-min-dtype/dist'),jr=require('@stdlib/array-base-min-signed-integer-dtype/dist'),d=require('@stdlib/complex-dtype/dist'),c=require('@stdlib/error-tools-fmtprodmsg/dist');function Br(){return null}function Mr(r,i){return l(r)?null:f(r)?new TypeError(c('1rXEw',d(r),i)):new TypeError(c('1rXEw',typeof r,i));}function Wr(r,i){return l(r)||f(r)?null:new TypeError(c('1rXEw',typeof r,i));}function zr(r,i){var a;return l(r)?Or(r)?(a=jr(r),P(a,i)?null:new TypeError(c('1rXEw',a,i))):new TypeError(c('1rXEw',N(r),i)):f(r)?new TypeError(c('1rXEw',d(r),i)):new TypeError(c('1rXEw',typeof r,i));}function Qr(r,i){var a;return l(r)?(a=N(r),P(a,i)?null:new TypeError(c('1rXEw',a,i))):f(r)?new TypeError(c('1rXEw',d(r),i)):new TypeError(c('1rXEw',typeof r,i));}function Xr(r){return r==="generic"||r===""?Br:Gr(r)?Mr:Fr(r)?Qr:Lr(r)?zr:Wr}V.exports=Xr
13
- });var O=u(function(kt,C){
14
- function Yr(r,i){return a;function a(t,n){var s,e;switch(e=n,e.length){case 0:s=new t;break;case 1:s=new t(e[0]);break;case 2:s=new t(e[0],e[1]);break;case 3:s=new t(e[0],e[1],e[2]);break;case 4:s=new t(e[0],e[1],e[2],e[3]);break;case 5:s=new t(e[0],e[1],e[2],e[3],e[4]);break;case 6:s=new t(e[0],e[1],e[2],e[3],e[4],e[5]);break;case 7:s=new t(e[0],e[1],e[2],e[3],e[4],e[5],e[6]);break;case 8:s=new t(e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7]);break;case 9:s=new t(e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8]);break;case 10:s=new t(e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8],e[9]);break;default:s=t.apply(null,e)}return r(s,i)}}C.exports=Yr
15
- });var F=u(function(_t,G){
16
- var $r=/^-?[0-9]+$/;G.exports=$r
17
- });var q=u(function(Pt,L){
18
- var Hr=require('@stdlib/assert-is-string/dist').isPrimitive,Jr=F();function Kr(r){return Hr(r)&&Jr.test(r)}L.exports=Kr
19
- });var B=u(function(Nt,j){
20
- var Zr=/\s*ArrayIndex<[^>]+>\s*/;j.exports=Zr
21
- });var W=u(function(Vt,M){
22
- var re=require('@stdlib/assert-is-string/dist').isPrimitive,ee=B();function te(r){return re(r)&&ee.test(r)}M.exports=te
23
- });var Q=u(function(Ut,z){
24
- var ie=require('@stdlib/string-base-trim/dist'),ae=require('@stdlib/error-tools-fmtprodmsg/dist');function ne(r){return r.substring(11,r.length-1)}function se(r,i){var a=i.get(ne(ie(r)));if(a===null)throw new Error(ae("invalid operation. Unable to resolve array index. Value: `%s`.",r));return a}z.exports=se
25
- });var Y=u(function(Ct,X){
26
- var ue=require('@stdlib/array-take/dist'),oe=require('@stdlib/array-base-mskfilter/dist'),ce=require('@stdlib/array-base-mskreject/dist'),ve=require('@stdlib/error-tools-fmtprodmsg/dist'),le=Q();function fe(r,i,a){var t=le(i,a.cache);if(t.type==="int")return a.postGetArray(ue(r,t.data));if(t.type==="bool")return a.postGetArray(oe(r,t.data));if(t.type==="mask")return a.postGetArray(ce(r,t.data));throw new Error(ve("invalid operation. Unrecognized array index type. Value: `%s`.",t.type))}X.exports=fe
27
- });var g=u(function(Ot,$){
28
- var pe=require('@stdlib/ndarray-base-normalize-index/dist'),ye=require('@stdlib/error-tools-fmtprodmsg/dist');function de(r,i,a){var t,n;if(t=parseInt(r,10),n=pe(t,i-1),n===-1){if(a)throw new RangeError(ye("invalid operation. Index exceeds array bounds."));return t}return n}$.exports=de
29
- });var J=u(function(Gt,H){
30
- var qe=g();function ge(r,i,a){return a.getter(r,qe(i,r.length,a.strict))}H.exports=ge
31
- });var Z=u(function(Ft,K){
32
- var me=require('@stdlib/assert-is-function/dist');function he(r,i,a,t){var n=r[i];if(me(n))return n===r.constructor?t.ctor:s;return n;function s(){var e,o;for(e=[],o=0;o<arguments.length;o++)e.push(arguments[o]);return n.apply(this===a?r:this,e)}}K.exports=he
33
- });var m=u(function(Lt,rr){
34
- var we=require('@stdlib/string-base-replace/dist');function Ee(r){return we(r,/^invalid argument/,"invalid operation")}rr.exports=Ee
35
- });var tr=u(function(jt,er){
36
- var be=/:/;er.exports=be
37
- });var h=u(function(Bt,ar){
38
- var Se=require('@stdlib/string-base-trim/dist'),ir=require('@stdlib/slice-base-seq2slice/dist'),Ie=require('@stdlib/slice-base-str2slice/dist'),Ae=require('@stdlib/string-base-starts-with/dist'),p=require('@stdlib/error-tools-fmtprodmsg/dist'),Te=tr();function xe(r){return r[0]==="S"&&Ae(r,"Slice(",0)&&r[r.length-1]===")"}function Re(r){return Te.test(r)}function De(r,i){var a=Ie(i);if(a===null)throw new Error(p('1rXEn',r));return a}function ke(r,i,a,t){var n=ir(i,a,!0);if(n.code){if(n.code==="ERR_SLICE_INVALID_INCREMENT")throw new Error(p('1rXEq',r));if(n.code==="ERR_SLICE_INVALID_SUBSEQUENCE")throw new Error(p('1rXEn',r));if(n.code==="ERR_SLICE_OUT_OF_BOUNDS"){if(t)throw new RangeError(p('1rXFU'));n=ir(i,a,!1)}}return n}function _e(r,i,a){var t=Se(i);return xe(t)?De(i,t):Re(t)?ke(i,t,r.length,a):null}ar.exports=_e
39
- });var sr=u(function(Mt,nr){
40
- var Pe=require('@stdlib/array-base-fancy-slice/dist'),Ne=m(),Ve=h();function Ue(r,i,a){var t=Ve(r,i,a.strict);if(t!==null)try{return a.postGetArray(Pe(r,t,a.strict))}catch(n){throw new n.constructor(Ne(n.message))}}nr.exports=Ue
41
- });var or=u(function(Wt,ur){
42
- var Ce=require('@stdlib/assert-is-string/dist').isPrimitive,Oe=require('@stdlib/assert-has-property/dist'),Ge=q(),Fe=W(),Le=Y(),je=J(),Be=Z(),Me=sr();function We(r){return i;function i(a,t,n){return Ge(t)?je(a,t,r):Oe(a,t)||!Ce(t)?Be(a,t,n,r):Fe(t)?Le(a,t,r):Me(a,t,r)}}ur.exports=We
43
- });var vr=u(function(zt,cr){
44
- var ze=g();function Qe(r,i,a,t){var n,s;if(n=t.validator(a,t.dtype),n)throw n;return t.preSetElement?s=t.preSetElement(a):s=a,t.setter(r,ze(i,r.length,t.strict),s),!0}cr.exports=Qe
45
- });var fr=u(function(Qt,lr){
46
- function Xe(r,i,a){return r[i]=a,!0}lr.exports=Xe
47
- });var yr=u(function(Xt,pr){
48
- var Ye=require('@stdlib/assert-is-collection/dist'),$e=require('@stdlib/array-base-fancy-slice-assign/dist'),He=require('@stdlib/array-from-scalar/dist'),Je=h(),Ke=m();function Ze(r,i,a,t,n){var s,e,o;if(e=Je(r,i,n.strict),e===null)return!1;if(Ye(a))o=a;else{if(s=n.validator(a,n.dtype),s)throw s;o=He(a,n.dtype)}try{return $e(o,t,e,n.strict),!0}catch(v){throw new v.constructor(Ke(v.message))}}pr.exports=Ze
49
- });var gr=u(function(Yt,qr){
50
- var rt=require('@stdlib/assert-is-string/dist').isPrimitive,et=require('@stdlib/assert-has-property/dist'),tt=q(),it=vr(),dr=fr(),at=yr();function nt(r){return i;function i(a,t,n,s){var e;return tt(t)?it(a,t,n,r):et(t)||!rt(t)?dr(a,t,n,r):(e=at(a,t,n,s,r),e||dr(a,t,n,r))}}qr.exports=nt
51
- });var w=u(function($t,wr){
52
- var st=require('@stdlib/assert-is-array-like/dist'),mr=require('@stdlib/proxy-ctor/dist'),ut=require('@stdlib/array-base-arraylike2object/dist'),ot=require('@stdlib/object-assign/dist'),ct=require('@stdlib/error-tools-fmtprodmsg/dist'),vt=b(),lt=I(),ft=T(),pt=R(),hr=_(),yt=U(),dt=O(),qt=or(),gt=gr();function mt(){var r,i;if(r=pt(),arguments.length&&(i=hr(r,arguments[0]),i))throw i;return a;function a(t){var n,s,e,o,v;if(!st(t))throw new TypeError(ct('1rX38',t));if(ft){if(n=ot({},r),arguments.length>1&&(s=hr(n,arguments[1]),s))throw s;return e=ut(t),o=e.dtype||"",v={ref:t,dtype:o,getter:e.accessors[0],setter:e.accessors[1],preSetElement:vt(o),postGetArray:lt(a,n),cache:n.cache,strict:n.strict,validator:yt(o),array2fancy:a,ctor:new mr(t.constructor||Array,{construct:dt(a,n)})},new mr(t,{get:qt(v),set:gt(v)})}return console.warn("WARNING: Proxy objects are not supported in the current environment. Some `FancyArray` functionality may not be available."),t}}wr.exports=mt
53
- });var br=u(function(Ht,Er){
54
- var ht=w(),wt=ht();Er.exports=wt
55
- });var Et=require('@stdlib/utils-define-nonenumerable-read-only-property/dist'),Sr=br(),bt=w();Et(Sr,"factory",bt);module.exports=Sr;
1
+ "use strict";var u=function(r,i){return function(){return i||r((i={exports:{}}).exports,i),i.exports}};var x=u(function(Xt,T){
2
+ var kr=require('@stdlib/array-base-assert-is-complex-floating-point-data-type/dist'),_r=require('@stdlib/assert-is-number/dist').isPrimitive;function Pr(r){return _r(r)?[r,0]:r}function Nr(r){return kr(r)?Pr:null}T.exports=Nr
3
+ });var R=u(function(Yt,D){
4
+ function Cr(r,i){return a;function a(t){return r(t,i)}}D.exports=Cr
5
+ });var _=u(function($t,k){
6
+ var Vr=require('@stdlib/proxy-ctor/dist'),Ur=typeof Vr=="function";k.exports=Ur
7
+ });var N=u(function(Ht,P){
8
+ var Or=require('@stdlib/array-index/dist');function Gr(){return{cache:Or,strict:!1}}P.exports=Gr
9
+ });var U=u(function(Jt,V){
10
+ var Br=require('@stdlib/assert-is-plain-object/dist'),C=require('@stdlib/assert-has-own-property/dist'),Fr=require('@stdlib/assert-is-boolean/dist').isPrimitive,Lr=require('@stdlib/assert-is-method-in/dist'),q=require('@stdlib/error-tools-fmtprodmsg/dist');function Mr(r,i){return Br(i)?C(i,"strict")&&(r.strict=i.strict,!Fr(r.strict))?new TypeError(q('1rX2o',"strict",r.strict)):C(i,"cache")&&(r.cache=i.cache,!Lr(r.cache,"get"))?new TypeError(q('1rXFb',"cache","get",r.cache)):null:new TypeError(q('1rX2V',i));}V.exports=Mr
11
+ });var F=u(function(Kt,B){
12
+ var f=require('@stdlib/assert-is-number/dist').isPrimitive,jr=require('@stdlib/assert-is-integer/dist').isPrimitive,zr=require('@stdlib/assert-is-boolean/dist').isPrimitive,p=require('@stdlib/assert-is-complex-like/dist'),Wr=require('@stdlib/array-base-assert-is-real-floating-point-data-type/dist'),Qr=require('@stdlib/array-base-assert-is-unsigned-integer-data-type/dist'),Xr=require('@stdlib/array-base-assert-is-signed-integer-data-type/dist'),Yr=require('@stdlib/array-base-assert-is-boolean-data-type/dist'),O=require('@stdlib/array-base-assert-is-safe-data-type-cast/dist'),G=require('@stdlib/array-min-dtype/dist'),$r=require('@stdlib/array-base-min-signed-integer-dtype/dist'),g=require('@stdlib/complex-dtype/dist'),v=require('@stdlib/error-tools-fmtprodmsg/dist');function Hr(){return null}function Jr(r,i){return zr(r)?null:new TypeError(v('1rXEw',typeof r,i));}function Kr(r,i){return f(r)?null:p(r)?new TypeError(v('1rXEw',g(r),i)):new TypeError(v('1rXEw',typeof r,i));}function Zr(r,i){return f(r)||p(r)?null:new TypeError(v('1rXEw',typeof r,i));}function re(r,i){var a;return f(r)?jr(r)?(a=$r(r),O(a,i)?null:new TypeError(v('1rXEw',a,i))):new TypeError(v('1rXEw',G(r),i)):p(r)?new TypeError(v('1rXEw',g(r),i)):new TypeError(v('1rXEw',typeof r,i));}function ee(r,i){var a;return f(r)?(a=G(r),O(a,i)?null:new TypeError(v('1rXEw',a,i))):p(r)?new TypeError(v('1rXEw',g(r),i)):new TypeError(v('1rXEw',typeof r,i));}function te(r){return r==="generic"||r===""?Hr:Wr(r)?Kr:Qr(r)?ee:Xr(r)?re:Yr(r)?Jr:Zr}B.exports=te
13
+ });var M=u(function(Zt,L){
14
+ function ae(r,i){return a;function a(t,n){var s,e;switch(e=n,e.length){case 0:s=new t;break;case 1:s=new t(e[0]);break;case 2:s=new t(e[0],e[1]);break;case 3:s=new t(e[0],e[1],e[2]);break;case 4:s=new t(e[0],e[1],e[2],e[3]);break;case 5:s=new t(e[0],e[1],e[2],e[3],e[4]);break;case 6:s=new t(e[0],e[1],e[2],e[3],e[4],e[5]);break;case 7:s=new t(e[0],e[1],e[2],e[3],e[4],e[5],e[6]);break;case 8:s=new t(e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7]);break;case 9:s=new t(e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8]);break;case 10:s=new t(e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8],e[9]);break;default:s=t.apply(null,e)}return r(s,i)}}L.exports=ae
15
+ });var z=u(function(ra,j){
16
+ var ie=/^-?[0-9]+$/;j.exports=ie
17
+ });var m=u(function(ea,W){
18
+ var ne=require('@stdlib/assert-is-string/dist').isPrimitive,se=z();function ue(r){return ne(r)&&se.test(r)}W.exports=ue
19
+ });var X=u(function(ta,Q){
20
+ var oe=/\s*ArrayIndex<[^>]+>\s*/;Q.exports=oe
21
+ });var h=u(function(aa,Y){
22
+ var ce=require('@stdlib/assert-is-string/dist').isPrimitive,ve=X();function le(r){return ce(r)&&ve.test(r)}Y.exports=le
23
+ });var w=u(function(ia,$){
24
+ var fe=require('@stdlib/string-base-trim/dist'),pe=require('@stdlib/error-tools-fmtprodmsg/dist');function ye(r){return r.substring(11,r.length-1)}function de(r,i){var a=i.get(ye(fe(r)));if(a===null)throw new Error(pe('1rXFa',r));return a}$.exports=de
25
+ });var J=u(function(na,H){
26
+ var qe=require('@stdlib/array-take/dist'),ge=require('@stdlib/array-mskfilter/dist'),me=require('@stdlib/array-mskreject/dist'),he=require('@stdlib/error-tools-fmtprodmsg/dist'),we=w();function Ee(r,i,a){var t=we(i,a.cache);if(t.type==="int")return a.postGetArray(qe(r,t.data));if(t.type==="bool")return a.postGetArray(ge(r,t.data));if(t.type==="mask")return a.postGetArray(me(r,t.data));throw new Error(he('1rXFZ',t.type))}H.exports=Ee
27
+ });var E=u(function(sa,K){
28
+ var be=require('@stdlib/ndarray-base-normalize-index/dist'),Se=require('@stdlib/error-tools-fmtprodmsg/dist');function Ie(r,i,a){var t,n;if(t=parseInt(r,10),n=be(t,i-1),n===-1){if(a)throw new RangeError(Se('1rXFY'));return t}return n}K.exports=Ie
29
+ });var rr=u(function(ua,Z){
30
+ var Ae=E();function Te(r,i,a){return a.getter(r,Ae(i,r.length,a.strict))}Z.exports=Te
31
+ });var tr=u(function(oa,er){
32
+ var xe=require('@stdlib/assert-is-function/dist');function De(r,i,a,t){var n=r[i];if(xe(n))return n===r.constructor?t.ctor:s;return n;function s(){var e,o;for(e=[],o=0;o<arguments.length;o++)e.push(arguments[o]);return n.apply(this===a?r:this,e)}}er.exports=De
33
+ });var y=u(function(ca,ar){
34
+ var Re=require('@stdlib/string-base-replace/dist');function ke(r){return Re(r,/^invalid arguments?/,"invalid operation")}ar.exports=ke
35
+ });var nr=u(function(va,ir){
36
+ var _e=/:/;ir.exports=_e
37
+ });var b=u(function(la,ur){
38
+ var Pe=require('@stdlib/string-base-trim/dist'),sr=require('@stdlib/slice-base-seq2slice/dist'),Ne=require('@stdlib/slice-base-str2slice/dist'),Ce=require('@stdlib/string-base-starts-with/dist'),d=require('@stdlib/error-tools-fmtprodmsg/dist'),Ve=nr();function Ue(r){return r[0]==="S"&&Ce(r,"Slice(",0)&&r[r.length-1]===")"}function Oe(r){return Ve.test(r)}function Ge(r,i){var a=Ne(i);if(a===null)throw new Error(d('1rXEn',r));return a}function Be(r,i,a,t){var n=sr(i,a,!0);if(n.code){if(n.code==="ERR_SLICE_INVALID_INCREMENT")throw new Error(d('1rXEq',r));if(n.code==="ERR_SLICE_INVALID_SUBSEQUENCE")throw new Error(d('1rXEn',r));if(n.code==="ERR_SLICE_OUT_OF_BOUNDS"){if(t)throw new RangeError(d('1rXFU'));n=sr(i,a,!1)}}return n}function Fe(r,i,a){var t=Pe(i);return Ue(t)?Ge(i,t):Oe(t)?Be(i,t,r.length,a):null}ur.exports=Fe
39
+ });var cr=u(function(fa,or){
40
+ var Le=require('@stdlib/array-base-fancy-slice/dist'),Me=y(),je=b();function ze(r,i,a){var t=je(r,i,a.strict);if(t!==null)try{return a.postGetArray(Le(r,t,a.strict))}catch(n){throw new n.constructor(Me(n.message))}}or.exports=ze
41
+ });var lr=u(function(pa,vr){
42
+ var We=require('@stdlib/assert-is-string/dist').isPrimitive,Qe=require('@stdlib/assert-has-property/dist'),Xe=m(),Ye=h(),$e=J(),He=rr(),Je=tr(),Ke=cr();function Ze(r){return i;function i(a,t,n){return Xe(t)?He(a,t,r):Qe(a,t)||!We(t)?Je(a,t,n,r):Ye(t)?$e(a,t,r):Ke(a,t,r)}}vr.exports=Ze
43
+ });var yr=u(function(ya,pr){
44
+ var rt=require('@stdlib/array-base-assert-is-mostly-safe-data-type-cast/dist'),et=require('@stdlib/array-base-assert-is-real-data-type/dist'),tt=require('@stdlib/array-base-assert-is-complex-floating-point-data-type/dist'),at=require('@stdlib/assert-is-collection/dist'),it=require('@stdlib/array-from-scalar/dist'),nt=require('@stdlib/array-dtype/dist'),st=require('@stdlib/array-put/dist'),ut=require('@stdlib/array-place/dist'),ot=require('@stdlib/array-convert/dist'),ct=require('@stdlib/array-base-where/dist').assign,fr=require('@stdlib/error-tools-fmtprodmsg/dist'),vt=w(),S=y();function lt(r,i,a,t){var n,s,e,o,c;if(e=vt(i,t.cache),n=t.dtype||"generic",at(a))c=a;else{if(o=t.validator(a,n),o)throw o;t.preSetElement?c=t.preSetElement(a):c=a,c=it(c,n),s=n}if(e.type==="int"){try{st(r,e.data,c)}catch(l){throw new l.constructor(S(l.message))}return!0}if(e.type==="bool"){try{ut(r,e.data,c,{mode:"strict_broadcast"})}catch(l){throw new l.constructor(S(l.message))}return!0}if(s===void 0&&(s=nt(a)||"generic"),!rt(s,n))throw new TypeError(fr('1rXEw',s,n));if(tt(n)&&et(s)&&(c=ot(c,n)),e.type==="mask"){try{ct(e.data,r,c,r,1,0)}catch(l){throw new l.constructor(S(l.message))}return!0}throw new Error(fr('1rXFZ',e.type))}pr.exports=lt
45
+ });var qr=u(function(da,dr){
46
+ var ft=E();function pt(r,i,a,t){var n,s;if(n=t.validator(a,t.dtype),n)throw n;return t.preSetElement?s=t.preSetElement(a):s=a,t.setter(r,ft(i,r.length,t.strict),s),!0}dr.exports=pt
47
+ });var mr=u(function(qa,gr){
48
+ function yt(r,i,a){return r[i]=a,!0}gr.exports=yt
49
+ });var wr=u(function(ga,hr){
50
+ var dt=require('@stdlib/assert-is-collection/dist'),qt=require('@stdlib/array-base-fancy-slice-assign/dist'),gt=require('@stdlib/array-from-scalar/dist'),mt=b(),ht=y();function wt(r,i,a,t,n){var s,e,o;if(e=mt(r,i,n.strict),e===null)return!1;if(dt(a))o=a;else{if(s=n.validator(a,n.dtype),s)throw s;o=gt(a,n.dtype||"generic")}try{qt(o,t,e,n.strict)}catch(c){throw new c.constructor(ht(c.message))}return!0}hr.exports=wt
51
+ });var Sr=u(function(ma,br){
52
+ var Et=require('@stdlib/assert-is-string/dist').isPrimitive,bt=require('@stdlib/assert-has-property/dist'),St=m(),It=h(),At=yr(),Tt=qr(),Er=mr(),xt=wr();function Dt(r){return i;function i(a,t,n,s){var e;return St(t)?Tt(a,t,n,r):bt(t)||!Et(t)?Er(a,t,n,r):It(t)?At(a,t,n,r):(e=xt(a,t,n,s,r),e||Er(a,t,n,r))}}br.exports=Dt
53
+ });var I=u(function(ha,Tr){
54
+ var Rt=require('@stdlib/assert-is-array-like/dist'),Ir=require('@stdlib/proxy-ctor/dist'),kt=require('@stdlib/array-base-arraylike2object/dist'),_t=require('@stdlib/object-assign/dist'),Pt=require('@stdlib/error-tools-fmtprodmsg/dist'),Nt=x(),Ct=R(),Vt=_(),Ut=N(),Ar=U(),Ot=F(),Gt=M(),Bt=lr(),Ft=Sr();function Lt(){var r,i;if(r=Ut(),arguments.length&&(i=Ar(r,arguments[0]),i))throw i;return a;function a(t){var n,s,e,o,c;if(!Rt(t))throw new TypeError(Pt('1rX38',t));if(Vt){if(n=_t({},r),arguments.length>1&&(s=Ar(n,arguments[1]),s))throw s;return e=kt(t),o=e.dtype||"",c={ref:t,dtype:o,getter:e.accessors[0],setter:e.accessors[1],preSetElement:Nt(o),postGetArray:Ct(a,n),cache:n.cache,strict:n.strict,validator:Ot(o),array2fancy:a,ctor:new Ir(t.constructor||Array,{construct:Gt(a,n)})},new Ir(t,{get:Bt(c),set:Ft(c)})}return console.warn("WARNING: Proxy objects are not supported in the current environment. Some `FancyArray` functionality may not be available."),t}}Tr.exports=Lt
55
+ });var Dr=u(function(wa,xr){
56
+ var Mt=I(),jt=Mt();xr.exports=jt
57
+ });var Rr=require('@stdlib/utils-define-nonenumerable-read-only-property/dist'),zt=require('@stdlib/array-index/dist'),A=Dr(),Wt=I();Rr(A,"factory",Wt);Rr(A,"idx",zt);module.exports=A;
56
58
  /** @license Apache-2.0 */
57
59
  //# sourceMappingURL=index.js.map