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 18, 2024
1 parent e448838 commit 516dee6
Show file tree
Hide file tree
Showing 13 changed files with 197 additions and 102 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/npm_downloads.yml
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,8 @@ jobs:
# Upload the download data:
- name: 'Upload data'
# Pin action to full length commit SHA corresponding to v3.1.3
uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32
# Pin action to full length commit SHA
uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1
with:
# Define a name for the uploaded artifact (ensuring a unique name for each job):
name: npm_downloads
Expand Down
14 changes: 4 additions & 10 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -124,16 +124,10 @@ jobs:
mv ./package.json.tmp ./package.json
fi
done
jq -r '.devDependencies | keys[]' ./package.json | while read -r dep; do
if [[ "$dep" != "@stdlib"* ]]; then
continue
fi
dep=$(echo "$dep" | xargs)
if ! find lib -name "*.js" -exec grep -q "$dep" {} + && ! grep -q -s "$dep" manifest.json && ! grep -q -s "$dep" include.gypi; then
jq --indent 2 "del(.devDependencies[\"$dep\"])" ./package.json > ./package.json.tmp
mv ./package.json.tmp ./package.json
fi
done
# Set `devDependencies` to an empty object:
jq --indent 2 '.devDependencies = {}' ./package.json > ./package.json.tmp
mv ./package.json.tmp ./package.json
# Remove CLI section:
find . -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?<section class=\"cli\">[\s\S]+?<\!\-\- \/.cli \-\->//"
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/test_bundles.yml
Original file line number Diff line number Diff line change
Expand Up @@ -168,8 +168,8 @@ jobs:

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

Expand Down
26 changes: 19 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,19 @@ var v = y[ 10 ];

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

#### array2fancy.idx( x\[, options] )

Wraps a provided array as an array index object.

```javascript
var x = [ 1, 2, 3, 4 ];

var idx = array2fancy.idx( x );
// returns <ArrayIndex>
```

For documentation and usage, see [`ArrayIndex`][@stdlib/array/index]

</section>

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

```javascript
var idx = require( '@stdlib/array-index' );

var x = array2fancy( [ 1, 2, 3, 4 ], {
'strict': false
});
Expand All @@ -291,7 +302,8 @@ v = x[ '10:' ];
// returns []

// Access one or more out-of-bounds indices:
v = x[ idx( [ 10, 20 ] ) ];
var i = array2fancy.idx( [ 10, 20 ] );
v = x[ i ];
// throws <RangeError>
```

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

```javascript
var idx = require( '@stdlib/array-index' );

var x = array2fancy( [ 1, 2, 3, 4 ], {
'strict': true
});
Expand All @@ -322,7 +332,8 @@ v = x[ '10:' ];
// throws <RangeError>

// Access one or more out-of-bounds indices:
v = x[ idx( [ 10, 20 ] ) ];
var i = array2fancy.idx( [ 10, 20 ] );
v = x[ i ];
// throws <RangeError>
```

Expand Down Expand Up @@ -478,7 +489,6 @@ im = imag( v );
```javascript
var Uint8Array = require( '@stdlib/array-uint8' );
var Int32Array = require( '@stdlib/array-int32' );
var idx = require( '@stdlib/array-index' );
var array2fancy = require( '@stdlib/array-to-fancy' );

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

// Array index retrieval:
var idx = array2fancy.idx;

var i = idx( [ 1, 3, 4 ] ); // integer index array
z = y[ i ];
// returns [ 2, -9, -8 ]
Expand Down
33 changes: 33 additions & 0 deletions benchmark/benchmark.get.js
Original file line number Diff line number Diff line change
Expand Up @@ -138,3 +138,36 @@ bench( pkg+'::get,subsequence:len=1', opts, function benchmark( b ) {
b.pass( 'benchmark finished' );
b.end();
});

bench( pkg+'::get,integer_array:len=1', opts, function benchmark( b ) {
var values;
var opts;
var x;
var v;
var i;

x = array2fancy( zeroTo( 100, 'generic' ) );

opts = {
'persist': true
};
values = [
array2fancy.idx( [ 1 ], opts ),
array2fancy.idx( [ 2 ], opts ),
array2fancy.idx( [ 3 ], opts )
];

b.tic();
for ( i = 0; i < b.iterations; i++ ) {
v = x[ values[ i%values.length ] ];
if ( typeof v !== 'object' ) {
b.fail( 'should return an array' );
}
}
b.toc();
if ( !isCollection( v ) ) {
b.fail( 'should return an array' );
}
b.pass( 'benchmark finished' );
b.end();
});
Loading

0 comments on commit 516dee6

Please sign in to comment.