@stdlib/array
Version:
Arrays.
85 lines (63 loc) • 2 kB
Plain Text
{{alias}}( x, predicate[, thisArg] )
Cumulatively tests whether every array element in a provided array fails a
test implemented by a predicate function, while iterating from right-to-
left.
The predicate function is provided three arguments:
- value: current array element.
- index: current array element index.
- arr: the input array.
Parameters
----------
x: ArrayLikeObject
Input array.
predicate: Function
Predicate function.
thisArg: any (optional)
Execution context.
Returns
-------
out: Array
Output array.
Examples
--------
> function fcn( v ) { return ( v > 0 ); };
> var x = [ 1, 1, 0, 0, 0 ];
> var y = {{alias}}( x, fcn )
[ true, true, true, false, false ]
{{alias}}.assign( x, out, stride, offset, predicate[, thisArg] )
Cumulatively tests whether every array element in a provided array fails a
test implemented by a predicate function, while iterating from right-to-
left, and assigns the results to the provided output array.
The predicate function is provided three arguments:
- value: current array element.
- index: current array element index.
- arr: the input array.
Parameters
----------
x: ArrayLikeObject
Input array.
out: ArrayLikeObject
Output array.
stride: integer
Output array stride.
offset: integer
Output array offset.
predicate: Function
Predicate function.
thisArg: any (optional)
Execution context.
Returns
-------
out: ArrayLikeObject
Output array.
Examples
--------
> function fcn( v ) { return ( v > 0 ); };
> var x = [ 1, 1, 0, 0 ];
> var out = [ false, null, false, null, false, null, false, null ];
> var arr = {{alias}}.assign( x, out, 2, 0, fcn )
[ true, null, true, null, false, null, false, null ]
> var bool = ( arr === out )
true
See Also
--------