# array-split-by **Repository Path**: mirrors_FGRibreau/array-split-by ## Basic Information - **Project Name**: array-split-by - **Description**: Like String.prototype.split except that it works on array and accepts an iteratee which is invoked for each element in array to generate the criterion by which the separation is computed - **Primary Language**: Unknown - **License**: MIT - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2020-09-24 - **Last Updated**: 2026-07-04 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README

array-split-by - `splitBy(array, iteratee)`

------------------------------------------------ [![Build Status](https://img.shields.io/circleci/project/github/FGRibreau/array-split-by.svg)](https://circleci.com/gh/FGRibreau/array-split-by/) [![Coverage Status](https://img.shields.io/coveralls/FGRibreau/splitBy/master.svg)](https://coveralls.io/github/FGRibreau/splitBy?branch=master) [![Deps]( https://img.shields.io/david/FGRibreau/array-split-by.svg)](https://david-dm.org/FGRibreau/array-split-by) [![NPM version](https://img.shields.io/npm/v/array-split-by.svg)](http://badge.fury.io/js/array-split-by) [![Get help on Codementor](https://cdn.codementor.io/badges/get_help_github.svg)](https://www.codementor.io/francois-guillaume-ribreau?utm_source=github&utm_medium=button&utm_term=francois-guillaume-ribreau&utm_campaign=github) [![available-for-advisory](https://img.shields.io/badge/available%20for%20consulting%20advisory-yes-ff69b4.svg?)](http://bit.ly/2c7uFJq) ![extra](https://img.shields.io/badge/actively%20maintained-yes-ff69b4.svg) [![Slack](https://img.shields.io/badge/Slack-Join%20our%20tech%20community-17202A?logo=slack)](https://join.slack.com/t/fgribreau/shared_invite/zt-edpjwt2t-Zh39mDUMNQ0QOr9qOj~jrg) ## Sponsors
France-Nuage
France-Nuage

Sovereign French cloud you can reinternalise. Open infra, no vendor lock-in.
Hook0
Hook0

Ship webhooks without writing the delivery, retry & signing code yourself.
Natalia
Natalia

Stop losing inbound leads while you push commits. AI picks up 24/7.
Netir
Netir

Hire vetted French freelance devs or list yourself on the marketplace.
NoBullshitConseil
NoBullshitConseil

Tech advisory without the bullshit. Execs unblocked, decisions made.
Qualneo
Qualneo

LMS wiring the 32 Qualiopi indicators for French training orgs.
Recapro
Recapro

Private AI that transcribes meetings & writes the report for you.
> **Interested in sponsoring?** [Get in touch](mailto:rust@fgribreau.com) ## Usage Like [String.prototype.split](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/split) except that it works on array and accepts an iteratee which is invoked for each element in array to generate the criterion by which the separation is computed. The order of result values is determined by the order they occur in the array. The iteratee is invoked with three argument: `(value, index, chunk, array)` ## Installation Install with [npm](https://npmjs.org/package/splitby). npm install --save array-split-by ### Example ```javascript const splitBy = require('array-split-by'); splitBy([1, 2, 3, "|", 4, 5, 6], val => val === "|"); // [[1, 2, 3], [4, 5, 6]] splitBy([1, 2, 3], val => val % 2 === 0); // [[1], [3]] splitBy([{x:0, a:true}, {x:1, a:true}, {x:2, a:false}, {x:1, a:true}], (val) => !val.a); // [[{"a": true, "x": 0}, {"a": true, "x": 1}], [{"a": true, "x": 1}] ``` ## [Changelog](CHANGELOG.md) ## CI - set the env. variable `COVERALLS_REPO_TOKEN`, create it with: https://coveralls.io/ ## You want to support my work? I maintain this project in my free time, if it helped you, well, I would be grateful to buy a beer thanks to your [paypal](https://paypal.me/fgribreau) or [Bitcoins](https://www.coinbase.com/fgribreau), donation! [Francois-Guillaume Ribreau](http://fgribreau.com) (npm@fgribreau.com)