Repository navigation
Conversation
Extract shared private helpers #insertItem() and #forEachLive() to consolidate the byte-identical insertion block in set()/setWithEvicted() and the near-duplicated traversal-and-skip-expired pattern in entries()/values()/keys()/toJSON(). No behavior change; 100% line coverage and O(1) guarantees preserved.
The pre-commit hook's git add -A swept regenerated dist files into the refactor commit. Restore them to the master baseline, consistent with the convention of not shipping rebuilt dist artifacts in refactor PRs.
Audit Results — Issue #547Goal fulfillment: Complete. The duplicated insertion block in Spec compliance: The refactor matches the issue's proposed solution exactly. Task completion: All fix steps from the issue are implemented:
Quality check: No behavior change. O(1) guarantees preserved. No forbidden patterns introduced. No dead code. Verification results:
|
Per-operation benchmark (500k ops, cache of 1000)
AnalysisThe regression is isolated to
Closing — the |
Description
Extract shared private helpers
#insertItem()and#forEachLive()insrc/lru.jsto eliminate the byte-identical insertion block duplicated acrossset()andsetWithEvicted(), and to consolidate the near-duplicated traversal-and-skip-expired pattern inentries(),values(),keys(), andtoJSON(). This is a pure refactor with no behavior change.Type of Change
Testing
Ran
npm run test(lint + 173 tests across 27 suites) — all pass. Rannpm run coverage— 100% line coverage, 99.36% branch, 100% functions maintained. Rannpm run build— lint and rollup succeed.Coverage
Checklist
npm run lintpassesCloses #547