Skip to content

chore: deduplicate lru insertion and traversal blocks - #548

Open
avoidwork wants to merge 3 commits into
masterfrom
chore/deduplicate-lru-insertion-and-traversal
Open

avoidwork wants to merge 3 commits into
masterfrom
chore/deduplicate-lru-insertion-and-traversal

Conversation

@avoidwork

Copy link
Copy Markdown
Owner

Description

Deduplicate two copy-paste patterns in src/lru.js flagged by a code-quality audit (issue #547, rule QUAL-003, low severity). Extracts a shared private #insertItem(key, value) helper used by set() and setWithEvicted(), and a shared #forEachLive(callback) traversal helper used by keys(), entries(), values(), and toJSON(). Pure refactor — no behavior change, no public API change.

Type of Change

  • Bugfix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update
  • Refactor (no functional changes)
  • Performance improvement
  • CI / build / tooling

Testing

No new tests required — this is a pure refactor with no behavior change. The existing 173-test suite (npm run test) is the regression guard and continues to pass. The new private helpers (#insertItem, #forEachLive) are exercised transitively by every existing set/keys/entries/values/toJSON test.

Coverage

  • 100% line coverage maintained

Checklist

  • npm run lint passes
  • Tests pass with 100% line coverage
  • No forbidden patterns used
  • Conventional Commit style applied

Closes #547

Issue #547 (QUAL-003): extract shared #insertItem and #forEachLive helpers
to remove copy-paste blocks in src/lru.js. Pure refactor, no behavior change.
@avoidwork avoidwork self-assigned this Nov 25, 2026
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.

feat: deduplicate copy-paste blocks in src/lru.js

1 participant