Skip to content

landau/split-with

Repository files navigation

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

About

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

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •