Skip to content

Commit a247478

Browse files
committed
Auto-generated commit
1 parent 723eaf4 commit a247478

File tree

11 files changed

+1673
-10
lines changed

11 files changed

+1673
-10
lines changed

benchmark/benchmark.get.js

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ var isCollection = require( '@stdlib/assert-is-collection' );
2525
var hasProxySupport = require( '@stdlib/assert-has-proxy-support' );
2626
var isnan = require( '@stdlib/assert-is-nan' ).isPrimitive;
2727
var zeroTo = require( '@stdlib/array-zero-to' );
28+
var zeros = require( '@stdlib/array-zeros' );
29+
var filledarray = require( '@stdlib/array-filled' );
2830
var Slice = require( '@stdlib/slice-ctor' );
2931
var pkg = require( './../package.json' ).name;
3032
var array2fancy = require( './../lib' );
@@ -171,3 +173,69 @@ bench( pkg+'::get,integer_array:len=1', opts, function benchmark( b ) {
171173
b.pass( 'benchmark finished' );
172174
b.end();
173175
});
176+
177+
bench( pkg+'::get,mask_array:len=1', opts, function benchmark( b ) {
178+
var values;
179+
var opts;
180+
var x;
181+
var v;
182+
var i;
183+
184+
x = array2fancy( zeros( 100, 'uint8' ) );
185+
186+
opts = {
187+
'persist': true
188+
};
189+
values = [
190+
array2fancy.idx( [ 1 ], opts ),
191+
array2fancy.idx( [ 2 ], opts ),
192+
array2fancy.idx( [ 3 ], opts )
193+
];
194+
195+
b.tic();
196+
for ( i = 0; i < b.iterations; i++ ) {
197+
v = x[ values[ i%values.length ] ];
198+
if ( typeof v !== 'object' ) {
199+
b.fail( 'should return an array' );
200+
}
201+
}
202+
b.toc();
203+
if ( !isCollection( v ) ) {
204+
b.fail( 'should return an array' );
205+
}
206+
b.pass( 'benchmark finished' );
207+
b.end();
208+
});
209+
210+
bench( pkg+'::get,boolean_array:len=1', opts, function benchmark( b ) {
211+
var values;
212+
var opts;
213+
var x;
214+
var v;
215+
var i;
216+
217+
x = array2fancy( filledarray( true, 100, 'generic' ) );
218+
219+
opts = {
220+
'persist': true
221+
};
222+
values = [
223+
array2fancy.idx( [ 1 ], opts ),
224+
array2fancy.idx( [ 2 ], opts ),
225+
array2fancy.idx( [ 3 ], opts )
226+
];
227+
228+
b.tic();
229+
for ( i = 0; i < b.iterations; i++ ) {
230+
v = x[ values[ i%values.length ] ];
231+
if ( typeof v !== 'object' ) {
232+
b.fail( 'should return an array' );
233+
}
234+
}
235+
b.toc();
236+
if ( !isCollection( v ) ) {
237+
b.fail( 'should return an array' );
238+
}
239+
b.pass( 'benchmark finished' );
240+
b.end();
241+
});

dist/index.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/index.js.map

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/repl.txt

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@
1414
configuration as specified by provided options.
1515

1616
A fancy array supports indexing using positive and negative integers (both
17-
numeric literals and strings), Slice instances, and subsequence expressions.
17+
numeric literals and strings), Slice instances, subsequence expressions,
18+
mask arrays, boolean arrays, and integer arrays.
1819

1920
A fancy array supports all properties and methods of the input array, and,
2021
thus, a fancy array can be consumed by any API which supports array-like
@@ -77,6 +78,8 @@
7778
If an array index is not associated with a provided identifier, the
7879
'get' method should return `null`.
7980

81+
Default: `{{alias:@stdlib/array/index}}`.
82+
8083
Returns
8184
-------
8285
out: Array|TypedArray|Object
@@ -118,6 +121,8 @@
118121
If an array index is not associated with a provided identifier, the
119122
'get' method should return `null`.
120123

124+
Default: `{{alias:@stdlib/array/index}}`.
125+
121126
Returns
122127
-------
123128
fcn: Function

lib/error_message.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ var replace = require( '@stdlib/string-base-replace' );
3333
* @returns {string} updated message
3434
*/
3535
function errMessage( msg ) {
36-
return replace( msg, /^invalid argument/, 'invalid operation' );
36+
return replace( msg, /^invalid arguments?/, 'invalid operation' );
3737
}
3838

3939

lib/get_elements.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@
2121
// MODULES //
2222

2323
var take = require( '@stdlib/array-take' );
24-
var mskfilter = require( '@stdlib/array-base-mskfilter' );
25-
var mskreject = require( '@stdlib/array-base-mskreject' );
24+
var mskfilter = require( '@stdlib/array-mskfilter' );
25+
var mskreject = require( '@stdlib/array-mskreject' );
2626
var format = require( '@stdlib/string-format' );
2727
var prop2array = require( './prop2array.js' );
2828

package.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,11 +46,11 @@
4646
"@stdlib/array-base-fancy-slice": "^0.3.0",
4747
"@stdlib/array-base-fancy-slice-assign": "^0.2.0",
4848
"@stdlib/array-base-min-signed-integer-dtype": "^0.2.0",
49-
"@stdlib/array-base-mskfilter": "^0.2.0",
50-
"@stdlib/array-base-mskreject": "^0.2.0",
5149
"@stdlib/array-from-scalar": "^0.2.0",
5250
"@stdlib/array-index": "^0.2.0",
5351
"@stdlib/array-min-dtype": "^0.2.0",
52+
"@stdlib/array-mskfilter": "github:stdlib-js/array-mskfilter#main",
53+
"@stdlib/array-mskreject": "github:stdlib-js/array-mskreject#main",
5454
"@stdlib/array-take": "^0.1.0",
5555
"@stdlib/assert-has-own-property": "^0.2.0",
5656
"@stdlib/assert-has-property": "^0.2.0",
@@ -81,6 +81,7 @@
8181
"@stdlib/array-base-to-accessor-array": "^0.2.0",
8282
"@stdlib/array-complex128": "^0.2.0",
8383
"@stdlib/array-complex64": "^0.2.0",
84+
"@stdlib/array-filled": "^0.2.0",
8485
"@stdlib/array-float32": "^0.2.0",
8586
"@stdlib/array-float64": "^0.2.0",
8687
"@stdlib/array-int32": "^0.2.0",
@@ -89,6 +90,7 @@
8990
"@stdlib/array-uint32": "^0.2.0",
9091
"@stdlib/array-uint8": "^0.2.0",
9192
"@stdlib/array-zero-to": "^0.2.0",
93+
"@stdlib/array-zeros": "^0.2.0",
9294
"@stdlib/assert-has-proxy-support": "^0.2.0",
9395
"@stdlib/assert-has-symbol-support": "^0.2.0",
9496
"@stdlib/assert-is-nan": "^0.2.0",

0 commit comments

Comments
 (0)