Skip to content

Commit 516dee6

Browse files
committed
Auto-generated commit
1 parent e448838 commit 516dee6

File tree

13 files changed

+197
-102
lines changed

13 files changed

+197
-102
lines changed

.github/workflows/npm_downloads.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,8 @@ jobs:
8686
8787
# Upload the download data:
8888
- name: 'Upload data'
89-
# Pin action to full length commit SHA corresponding to v3.1.3
90-
uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32
89+
# Pin action to full length commit SHA
90+
uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1
9191
with:
9292
# Define a name for the uploaded artifact (ensuring a unique name for each job):
9393
name: npm_downloads

.github/workflows/publish.yml

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -124,16 +124,10 @@ jobs:
124124
mv ./package.json.tmp ./package.json
125125
fi
126126
done
127-
jq -r '.devDependencies | keys[]' ./package.json | while read -r dep; do
128-
if [[ "$dep" != "@stdlib"* ]]; then
129-
continue
130-
fi
131-
dep=$(echo "$dep" | xargs)
132-
if ! find lib -name "*.js" -exec grep -q "$dep" {} + && ! grep -q -s "$dep" manifest.json && ! grep -q -s "$dep" include.gypi; then
133-
jq --indent 2 "del(.devDependencies[\"$dep\"])" ./package.json > ./package.json.tmp
134-
mv ./package.json.tmp ./package.json
135-
fi
136-
done
127+
128+
# Set `devDependencies` to an empty object:
129+
jq --indent 2 '.devDependencies = {}' ./package.json > ./package.json.tmp
130+
mv ./package.json.tmp ./package.json
137131
138132
# Remove CLI section:
139133
find . -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?<section class=\"cli\">[\s\S]+?<\!\-\- \/.cli \-\->//"

.github/workflows/test_bundles.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -168,8 +168,8 @@ jobs:
168168

169169
# Install Deno:
170170
- name: 'Install Deno'
171-
# Pin action to full length commit SHA corresponding to v1.1.2
172-
uses: denoland/setup-deno@61fe2df320078202e33d7d5ad347e7dcfa0e8f31
171+
# Pin action to full length commit SHA
172+
uses: denoland/setup-deno@041b854f97b325bd60e53e9dc2de9cb9f9ac0cba # v1.1.4
173173
with:
174174
deno-version: vx.x.x
175175

README.md

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -241,6 +241,19 @@ var v = y[ 10 ];
241241

242242
The returned function supports the same options as above. When the returned function is provided option values, those values override the factory method defaults.
243243

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+
244257
</section>
245258

246259
<!-- /.usage -->
@@ -269,8 +282,6 @@ Accordingly, when `strict` is `false`, one may observe the following behaviors:
269282
<!-- run throws: true -->
270283

271284
```javascript
272-
var idx = require( '@stdlib/array-index' );
273-
274285
var x = array2fancy( [ 1, 2, 3, 4 ], {
275286
'strict': false
276287
});
@@ -291,7 +302,8 @@ v = x[ '10:' ];
291302
// returns []
292303

293304
// 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 ];
295307
// throws <RangeError>
296308
```
297309

@@ -300,8 +312,6 @@ When `strict` is `true`, fancy arrays normalize index behavior and consistently
300312
<!-- run throws: true -->
301313

302314
```javascript
303-
var idx = require( '@stdlib/array-index' );
304-
305315
var x = array2fancy( [ 1, 2, 3, 4 ], {
306316
'strict': true
307317
});
@@ -322,7 +332,8 @@ v = x[ '10:' ];
322332
// throws <RangeError>
323333

324334
// 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 ];
326337
// throws <RangeError>
327338
```
328339

@@ -478,7 +489,6 @@ im = imag( v );
478489
```javascript
479490
var Uint8Array = require( '@stdlib/array-uint8' );
480491
var Int32Array = require( '@stdlib/array-int32' );
481-
var idx = require( '@stdlib/array-index' );
482492
var array2fancy = require( '@stdlib/array-to-fancy' );
483493

484494
var x = [ 1, 2, 3, 4, 5, 6 ];
@@ -505,6 +515,8 @@ z = y[ ':' ];
505515
// returns [ 1, 2, -10, -9, -8, 6 ]
506516

507517
// Array index retrieval:
518+
var idx = array2fancy.idx;
519+
508520
var i = idx( [ 1, 3, 4 ] ); // integer index array
509521
z = y[ i ];
510522
// returns [ 2, -9, -8 ]

benchmark/benchmark.get.js

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,3 +138,36 @@ bench( pkg+'::get,subsequence:len=1', opts, function benchmark( b ) {
138138
b.pass( 'benchmark finished' );
139139
b.end();
140140
});
141+
142+
bench( pkg+'::get,integer_array:len=1', opts, function benchmark( b ) {
143+
var values;
144+
var opts;
145+
var x;
146+
var v;
147+
var i;
148+
149+
x = array2fancy( zeroTo( 100, 'generic' ) );
150+
151+
opts = {
152+
'persist': true
153+
};
154+
values = [
155+
array2fancy.idx( [ 1 ], opts ),
156+
array2fancy.idx( [ 2 ], opts ),
157+
array2fancy.idx( [ 3 ], opts )
158+
];
159+
160+
b.tic();
161+
for ( i = 0; i < b.iterations; i++ ) {
162+
v = x[ values[ i%values.length ] ];
163+
if ( typeof v !== 'object' ) {
164+
b.fail( 'should return an array' );
165+
}
166+
}
167+
b.toc();
168+
if ( !isCollection( v ) ) {
169+
b.fail( 'should return an array' );
170+
}
171+
b.pass( 'benchmark finished' );
172+
b.end();
173+
});

0 commit comments

Comments
 (0)