FGRibreau / FGRibreau/array-split-by
Open to a third argument to keep the elements to split at?
- 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