FGRibreau / FGRibreau/array-split-by

Open to a third argument to keep the elements to split at?

Open
#1 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
2
Forks
0
PR merge metrics
No merged PRs in 30d

Description

Sometimes you want to keep the element that causes the split (i.e., that the iteratee evaluates to true), i.e.,
```js
splitBy([1, 2, 3, "|", 4, 5, 6], val => val === "|", true); // [[1, 2, 3], ["|", 4, 5, 6]]
// ^^^^ NEW ^^^ NEW
```
Would you be open to accepting a pull request that implements this? The third argument could be called `keepSeparator` or something?

Contributor guide

No contributing guide indexed for this repository

Research direction

Start at the splitBy entry point and inspect how the iteratee currently determines boundaries. Implement and verify the third-argument behavior shown in the issue, ensuring the matching separator is retained at the start of the following chunk.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
tooling
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.