Skip to content

feat(array): add arrIndexOfSubset() and arrLastIndexOfSubset()#592

Merged
nev21 merged 3 commits into
mainfrom
nev21/Release
Jul 19, 2026
Merged

feat(array): add arrIndexOfSubset() and arrLastIndexOfSubset()#592
nev21 merged 3 commits into
mainfrom
nev21/Release

Conversation

@nev21

@nev21 nev21 commented Jul 19, 2026

Copy link
Copy Markdown
Contributor

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.

@nev21 nev21 added this to the 0.17.0 milestone Jul 19, 2026
Copilot AI review requested due to automatic review settings July 19, 2026 20:18
@nev21
nev21 requested review from a team as code owners July 19, 2026 20:18
@codecov

codecov Bot commented Jul 19, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 99.19%. Comparing base (ef09e0d) to head (2e30ee5).

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              
Files with missing lines Coverage Δ
lib/src/array/arrIndexOfSubset.ts 100.00% <100.00%> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread lib/src/array/arrIndexOfSubset.ts Outdated
Comment thread lib/src/array/arrIndexOfSubset.ts Outdated
Comment thread lib/test/src/common/array/arrIndexOfSubset.test.ts
Comment thread lib/test/src/common/array/arrIndexOfSubset.test.ts
Comment thread lib/test/src/common/array/arrIndexOfSubset.test.ts

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 7 out of 7 changed files in this pull request and generated 2 comments.

Comment thread lib/src/array/arrIndexOfSubset.ts
Comment thread lib/test/src/common/array/arrIndexOfSubset.test.ts
nevware21-bot
nevware21-bot previously approved these changes Jul 19, 2026

@nevware21-bot nevware21-bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved by nevware21-bot

nev21 and others added 2 commits July 19, 2026 15:02
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>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.

Comment thread lib/src/array/arrIndexOfSubset.ts Outdated
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 7 out of 7 changed files in this pull request and generated no new comments.

@nev21
nev21 enabled auto-merge (squash) July 19, 2026 23:11

@nevware21-bot nevware21-bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved by nevware21-bot

@nev21
nev21 merged commit 8e2e1d3 into main Jul 19, 2026
11 checks passed
@nev21
nev21 deleted the nev21/Release branch July 19, 2026 23:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants