js
just-split
npm i just-split
js

just-split

A library of dependency-free JavaScript utilities that do just one thing.

by angus croll

3.1.1 (see all)License:MITTypeScript:Built-In
npm i just-split
Readme

just-split

Part of a library of zero-dependency npm modules that do just do one thing. Guilt-free utilities for every occasion.

🍦 Try it

npm install just-split
yarn add just-split

Splits array into groups of n items each

import split from 'just-split';

split([]); // []
split([1, 2, 3, 4, 5]); // [[1, 2, 3, 4, 5]]
split([1, 2, 3, 4, 5, 6, 7, 8, 9], 3); // [[1, 2, 3], [4, 5, 6], [7, 8, 9]]
split([1, 2, 3, 4, 5, 6, 7, 8, 9], '3'); // [[1, 2, 3], [4, 5, 6], [7, 8, 9]]
split(['a', 'b', 'c', 'd', 'e'], 2); // [['a', 'b'], ['c', 'd'], ['e']]
split([1, 2, 3, 4, 5, 6, 7, 8], 3); // [[1, 2, 3], [4, 5, 6], [7, 8]]

Downloads/wk

2.9K

GitHub Stars

4.7K

LAST COMMIT

9mos ago

MAINTAINERS

1

CONTRIBUTORS

75

OPEN ISSUES

14

OPEN PRs

7
VersionTagPublished
3.1.1
latest
4mos ago
No alternatives found
No tutorials found
Add a tutorial
No dependencies found

Rate & Review

100
No reviews found
Be the first to rate