Select from array while

fjs.while

fjs.while returns items from an array while the iterator function returns true. Unlike fjs.select, this function limits the returned array to the first item that evaluates false. Can be curried by default.

Usage

fjs.while(iterator, items);

Example

var whileEven = fjs.while(function (item) {
return item % 2 === 0;
});
whileEven([2, 4, 5, 6]); // => [2, 4]