Open
Description
A.dropWhile
drops ALL items matching the predicate. It behaves exactly like A.reject
:
import {A,D} from "@mobily/ts-belt"
console.log(
A.dropWhile([0 , 1, 0, 0, 0], (x) => x == 0), // should drop the first zero
A.reject ([0 , 1, 0, 0, 0], (x) => x == 0), // should drop all zeros
A.dropWhile([{},{foo: "Bar"},{},{},{}], (x) => D.isEmpty(x)), // should drop the first empty obj
A.reject([{},{foo: "Bar"},{},{},{}], (x) => D.isEmpty(x)), // should drop all empty objs
)
[ 1 ] // dropWhile, expected [ 1, 0, 0, 0 ]
[ 1 ] // reject
[ { foo: 'Bar' } ] // dropWhile, expected [ { foo: 'Bar' }, {}, {}, {} ]
[ { foo: 'Bar' } ] // reject
Metadata
Metadata
Assignees
Labels
No labels