You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+19-7Lines changed: 19 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -241,6 +241,19 @@ var v = y[ 10 ];
241
241
242
242
The returned function supports the same options as above. When the returned function is provided option values, those values override the factory method defaults.
243
243
244
+
#### array2fancy.idx( x\[, options] )
245
+
246
+
Wraps a provided array as an array index object.
247
+
248
+
```javascript
249
+
var x = [ 1, 2, 3, 4 ];
250
+
251
+
var idx =array2fancy.idx( x );
252
+
// returns <ArrayIndex>
253
+
```
254
+
255
+
For documentation and usage, see [`ArrayIndex`][@stdlib/array/index]
256
+
244
257
</section>
245
258
246
259
<!-- /.usage -->
@@ -269,8 +282,6 @@ Accordingly, when `strict` is `false`, one may observe the following behaviors:
269
282
<!-- run throws: true -->
270
283
271
284
```javascript
272
-
var idx =require( '@stdlib/array-index' );
273
-
274
285
var x =array2fancy( [ 1, 2, 3, 4 ], {
275
286
'strict':false
276
287
});
@@ -291,7 +302,8 @@ v = x[ '10:' ];
291
302
// returns []
292
303
293
304
// Access one or more out-of-bounds indices:
294
-
v = x[ idx( [ 10, 20 ] ) ];
305
+
var i =array2fancy.idx( [ 10, 20 ] );
306
+
v = x[ i ];
295
307
// throws <RangeError>
296
308
```
297
309
@@ -300,8 +312,6 @@ When `strict` is `true`, fancy arrays normalize index behavior and consistently
300
312
<!-- run throws: true -->
301
313
302
314
```javascript
303
-
var idx =require( '@stdlib/array-index' );
304
-
305
315
var x =array2fancy( [ 1, 2, 3, 4 ], {
306
316
'strict':true
307
317
});
@@ -322,7 +332,8 @@ v = x[ '10:' ];
322
332
// throws <RangeError>
323
333
324
334
// Access one or more out-of-bounds indices:
325
-
v = x[ idx( [ 10, 20 ] ) ];
335
+
var i =array2fancy.idx( [ 10, 20 ] );
336
+
v = x[ i ];
326
337
// throws <RangeError>
327
338
```
328
339
@@ -478,7 +489,6 @@ im = imag( v );
478
489
```javascript
479
490
varUint8Array=require( '@stdlib/array-uint8' );
480
491
varInt32Array=require( '@stdlib/array-int32' );
481
-
var idx =require( '@stdlib/array-index' );
482
492
var array2fancy =require( '@stdlib/array-to-fancy' );
0 commit comments