0.0.2 • Published 8 years ago

splitwith v0.0.2

Weekly downloads
4
License
MIT
Repository
github
Last release
8 years ago

splitWith Build Status

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

Install

$ npm install --save splitwith

Usage

const splitWith = require('splitwith')

splitWith([1, 2, 3, 4, 5, 6], (x) => (x < 3)) // [[1, 2], [3, 4, 5, 6]]

// array-like objects
splitWith('abcdef', (x) => (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