UNPKG

@extra-array/cut-right

Version:

Breaks array after test passes.

52 lines (38 loc) 1.59 kB
Breaks array after test passes. [:package:](https://www.npmjs.com/package/@extra-array/cut-right) [:smiley_cat:](https://github.com/orgs/nodef/packages?repo_name=extra-array) [:running:](https://npm.runkit.com/@extra-array/cut-right) [:vhs:](https://asciinema.org/a/332036) [:moon:](https://www.npmjs.com/package/@extra-array/cut-right.min) [:scroll:](https://unpkg.com/@extra-array/cut-right/) [:newspaper:](https://nodef.github.io/extra-array/) [:blue_book:](https://github.com/nodef/extra-array/wiki/) > Alternatives: [cut], [cutRight], [cutAt], [cutAtRight].<br> > Similar: [cut], [split], [group]. > This is part of package [extra-array]. [extra-array]: https://www.npmjs.com/package/extra-array <br> ```javascript array.cutRight(x, ft); // x: an array // ft: test function (v, i, x) ``` ```javascript const array = require("extra-array"); var x = [1, 2, 3, 4, 5]; array.cutRight(x, [1, 3]); // [ [ 1, 2 ], [ 3, 4 ], [ 5 ] ] array.cutRight(x, [0, 4]); // [ [ 1 ], [ 2, 3, 4, 5 ], [] ] ``` <br> <br> ## References - [Data.List.splitAt: Haskell](https://hackage.haskell.org/package/base-4.12.0.0/docs/Data-List.html#v:splitAt) - [numpy.split: Python](https://docs.scipy.org/doc/numpy/reference/generated/numpy.split.html) [cut]: https://github.com/nodef/extra-array/wiki/cut [cutRight]: https://github.com/nodef/extra-array/wiki/cutRight [split]: https://github.com/nodef/extra-array/wiki/split [cutAt]: https://github.com/nodef/extra-array/wiki/cutAt [cutAtRight]: https://github.com/nodef/extra-array/wiki/cutAtRight [group]: https://github.com/nodef/extra-array/wiki/group