@stdlib/array
Version:
Arrays.
31 lines (22 loc) • 664 B
Plain Text
{{alias}}( x, mask )
Returns a new array by applying a mask to a provided input array.
If a mask array element is truthy, the corresponding element in `x` is
included in the output array; otherwise, the corresponding element in `x` is
"masked" and thus excluded from the output array.
Parameters
----------
x: Array|TypedArray|Object
Input array.
mask: Array|TypedArray|Object
Mask array.
Returns
-------
out: Array|TypedArray|Object
Output array.
Examples
--------
> var x = [ 1, 2, 3, 4 ];
> var y = {{alias}}( x, [ 0, 1, 0, 1 ] )
[ 2, 4 ]
See Also
--------