close
Skip to content

feat(data-structures/unstable): add RollingCounter.at() and toArray()#7102

Open
tomas-zijdemans wants to merge 1 commit intodenoland:mainfrom
tomas-zijdemans:rolling-next
Open

feat(data-structures/unstable): add RollingCounter.at() and toArray()#7102
tomas-zijdemans wants to merge 1 commit intodenoland:mainfrom
tomas-zijdemans:rolling-next

Conversation

@tomas-zijdemans
Copy link
Copy Markdown
Contributor

This PR is mostly about aligning RollingCounter with Deque, IndexedHeap, MultiMap and other data-structures.

  • RollingCounter now implements Iterable.
  • [Symbol.toStringTag] is a readonly "RollingCounter" as const property (was a getter).
  • @experimental tag added to every public-member JSDoc.
  • Class JSDoc gained a complexity table.
  • New at(index) with Array.prototype.at semantics (oldest→newest, negatives from newest end, out-of-range → undefined).
  • New toArray(); toJSON() delegates to it.
  • RollingCounterSnapshot.segments is readonly number[]; field is readonly.
  • from() accepts RollingCounterSnapshot, guards null/undefined/non-object, throws TypeError for shape errors, keeps RangeError for per-element numeric errors.
  • Tests: two RangeError cases flipped to TypeError; added null/undefined snapshot, toArray, and at tests.

@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 22, 2026

Codecov Report

❌ Patch coverage is 97.05882% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 94.59%. Comparing base (f318978) to head (4b6e0b7).

Files with missing lines Patch % Lines
data_structures/unstable_rolling_counter.ts 97.05% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #7102      +/-   ##
==========================================
- Coverage   94.59%   94.59%   -0.01%     
==========================================
  Files         632      632              
  Lines       51780    51797      +17     
  Branches     9324     9331       +7     
==========================================
+ Hits        48981    48997      +16     
  Misses       2225     2225              
- Partials      574      575       +1     

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

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.

1 participant