feat(array): add arrIndexOfSubset() and arrLastIndexOfSubset()#592
Merged
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #592 +/- ##
==========================================
+ Coverage 99.17% 99.19% +0.01%
==========================================
Files 179 180 +1
Lines 5481 5573 +92
Branches 1212 1285 +73
==========================================
+ Hits 5436 5528 +92
Misses 45 45
🚀 New features to boost your workflow:
|
Contributor
There was a problem hiding this comment.
Pull request overview
This PR introduces two new array utilities, arrIndexOfSubset() and arrLastIndexOfSubset(), for finding the first/last contiguous occurrence of a “subset” sequence within a larger array/array-like value, with special handling for repeated leading values and for subsets that overrun the end of the target array.
Changes:
- Added
arrIndexOfSubset()/arrLastIndexOfSubset()implementation and exported them from the public entrypoint. - Added common test coverage for both functions (including array-like inputs and repeated-leading-value scenarios).
- Updated docs/changelog and adjusted bundle/size-limit thresholds to account for the added code.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| README.md | Lists the new Array / ArrayLike helpers in the utilities index. |
| lib/src/array/arrIndexOfSubset.ts | Adds the new subset-search implementations and TSDoc. |
| lib/src/index.ts | Exposes the new helpers from the package root exports. |
| lib/test/src/common/array/arrIndexOfSubset.test.ts | Adds tests for the new helpers. |
| CHANGELOG.md | Notes the new feature under Unreleased. |
| lib/test/bundle-size-check.js | Raises bundle size thresholds for minified builds. |
| .size-limit.json | Raises size-limit thresholds for ES5/ES6 builds. |
nevware21-bot
previously approved these changes
Jul 19, 2026
nevware21-bot
left a comment
Contributor
There was a problem hiding this comment.
Approved by nevware21-bot
Locates the first/last index at which an array of values matches contiguously within another, re-searching later/earlier occurrences of the leading value when it repeats (e.g. matching one stack trace against another) instead of stopping at the first, wrong occurrence. A subset that runs off the end of theArray still matches against its available prefix, so a shorter (e.g. truncated) array can be matched against a longer one, or vice-versa.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
nev21
enabled auto-merge (squash)
July 19, 2026 23:11
nevware21-bot
approved these changes
Jul 19, 2026
nevware21-bot
left a comment
Contributor
There was a problem hiding this comment.
Approved by nevware21-bot
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Locates the first/last index at which an array of values matches contiguously within another, re-searching later/earlier occurrences of the leading value when it repeats (e.g. matching one stack trace against another) instead of stopping at the first, wrong occurrence. A subset that runs off the end of theArray still matches against its available prefix, so a shorter (e.g. truncated) array can be matched against a longer one, or vice-versa.