splitwith

0.0.2 • Public • Published

splitWith Build Status

Returns an array of takeWhile(arr, pred), dropWhile(arr, pred)

Install

$ npm install --save splitwith

Usage

const splitWith = require('splitwith')
 
splitWith([1, 2, 3, 4, 5, 6], (x) => (< 3)) // [[1, 2], [3, 4, 5, 6]]
 
// array-like objects
splitWith('abcdef', (x) => (< 'c')) // [['a', 'b'], ['c', 'd', 'e', 'f']]

API

splitWith(arr, pred)

arr

Type: array or array-like objects

pred

Type: function

Usage is same as https://lodash.com/docs#takeWhile

License

MIT © JIANG Di

Package Sidebar

Install

npm i splitwith

Weekly Downloads

1

Version

0.0.2

License

MIT

Last publish

Collaborators

  • jiang-di