Have ideas to improve npm?Join in the discussion! »

split-with

3.0.2 • Public • Published

Build Status

split-with

Returns an array of [takeWhile(coll, pred), dropWhile(coll, pred)]

function splitWith(coll, pred, ctx) { }

Install

npm i -S split-with

Usage

var assert = require('assert');
var splitWith = require('split-with');
var is = require('is-predicate');
 
function gtEq3(val) {
  return is.greaterEq(3, val);
}
 
var arr = [1, 2, 3, 4, 5];
var expected = [[1, 2, 3], [4, 5]];
 
assert.deepEqual(splitWith(arr, gtEq3), expected); // true

Install

npm i split-with

DownloadsWeekly Downloads

32

Version

3.0.2

License

ISC

Unpacked Size

4.78 kB

Total Files

5

Last publish

Collaborators

  • avatar