Skip to content

feat(data-structures/unstable): add includes() and removeAt() to Deque#7083

Merged
bartlomieju merged 4 commits intodenoland:mainfrom
tomas-zijdemans:deque-ready
Apr 10, 2026
Merged

feat(data-structures/unstable): add includes() and removeAt() to Deque#7083
bartlomieju merged 4 commits intodenoland:mainfrom
tomas-zijdemans:deque-ready

Conversation

@tomas-zijdemans
Copy link
Copy Markdown
Contributor

@tomas-zijdemans tomas-zijdemans commented Apr 3, 2026

  • Add includes() method (matching Array.prototype.includes), and removeAt(index) for removing elements by index with negative-index support.
  • Add a time-complexity table to the Deque class JSDoc to match BinaryHeap docs.
  • Extract #maybeGrow() and #removeAtUnchecked() private helpers to reduce duplication

@tomas-zijdemans tomas-zijdemans changed the title feat(data-structures/unstable): add includes() and removeAt() to Deque feat(data-structures/unstable): add includes() and removeAt() to Deque Apr 3, 2026
@codecov
Copy link
Copy Markdown

codecov bot commented Apr 3, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 94.42%. Comparing base (224adef) to head (7994891).
⚠️ Report is 2 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #7083   +/-   ##
=======================================
  Coverage   94.42%   94.42%           
=======================================
  Files         630      630           
  Lines       50533    50546   +13     
  Branches     8964     8964           
=======================================
+ Hits        47717    47730   +13     
  Misses       2247     2247           
  Partials      569      569           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 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.

Copy link
Copy Markdown
Member

@bartlomieju bartlomieju left a comment

Choose a reason for hiding this comment

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

Thanks for the PR! includes() and removeAt() are good additions, and the refactoring (#maybeGrow, #removeAtUnchecked) is clean. The complexity table is a nice touch.

A few high-level points beyond the inline comments:

PR scope is broad

This bundles four concerns: new features (includes, removeAt), docs (complexity table), perf optimizations (iterator rewrite, toArray/#copyBuffer/from() changes), and refactoring (#maybeGrow, #removeAtUnchecked). I'd suggest splitting the perf optimizations into a separate PR — they have different risk profiles and the iterator behavior change in particular deserves focused review.

Codecov flags 4 uncovered lines

The coverage report shows 3 missing + 1 partial line in unstable_deque.ts. Worth checking which lines those are and adding test coverage.

Comment thread data_structures/unstable_deque.ts Outdated
Comment thread data_structures/unstable_deque.ts Outdated
Comment thread data_structures/unstable_deque.ts Outdated
Comment thread data_structures/unstable_deque.ts Outdated
@tomas-zijdemans
Copy link
Copy Markdown
Contributor Author

Thanks. I've reverted the perf tweaks. Will consider a secondary PR for those.

@bartlomieju bartlomieju merged commit 5f6936e into denoland:main Apr 10, 2026
19 checks passed
tomas-zijdemans added a commit to tomas-zijdemans/std_cb that referenced this pull request Apr 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants