UNPKG

@stdlib/array

Version:
40 lines (28 loc) 861 B
{{alias}}( x, predicate[, thisArg] ) Returns a shallow copy of an array containing only those elements which fail a test implemented by a predicate function. The predicate function is provided three arguments: - value: current array element. - index: current array element index. - arr: the input array. The function performs a linear scan and always returns a generic array. Parameters ---------- x: Array|TypedArray|Object Input array. predicate: Function Predicate function. thisArg: any (optional) Execution context. Returns ------- out: Array|TypedArray|Object Output array. Examples -------- > function f( v ) { return ( v > 0 ); }; > var x = [ 1, -2, -3, 4 ]; > var out = {{alias}}( x, f ) [ -2, -3 ] See Also --------