Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
55 commits
Select commit Hold shift + click to select a range
3b5d733
Add peek() method to retrieve value without LRU update
avoidwork Mar 29, 2026
55c3c6c
Add comprehensive tests for 9 LRU utility methods
avoidwork Mar 29, 2026
b60f566
Add tests for noTTL items in sizeByTTL/keysByTTL
avoidwork Mar 29, 2026
3ddaeba
Docs: sort Methods table alphabetically
avoidwork Mar 29, 2026
a2f3652
README: fix badge order and remove duplicate tag line
avoidwork Mar 29, 2026
d30a7ff
README: complete rewrite based on source documentation
avoidwork Mar 29, 2026
92c78cc
README: fix build status badge URL
avoidwork Mar 29, 2026
0c25ff2
ci.yml: add push event for master branch
avoidwork Mar 29, 2026
fa769cb
README: use full GitHub paths for markdown doc links
avoidwork Mar 29, 2026
dc636cc
README: correct comparison table values
avoidwork Mar 29, 2026
31362e7
build: remove UMD output format
avoidwork Mar 29, 2026
f4ceed2
docs: remove UMD mentions from README.md, AGENTS.md and TECHNICAL_DOC…
avoidwork Mar 29, 2026
0c727d6
docs: update test coverage metrics
avoidwork Mar 29, 2026
c1c95d3
docs: order methods alphabetically, expand ToC
avoidwork Mar 29, 2026
6100688
Add documentation links to README.md
avoidwork Mar 29, 2026
69d3ea8
Fix incorrect resetTtl documentation and readonly properties
avoidwork Mar 29, 2026
212a42a
evict(): clear item.prev to allow garbage collection
avoidwork Mar 29, 2026
d5d914c
cleanup(): fix inconsistency with expiry === 0 handling
avoidwork Mar 29, 2026
94a31a7
docs: correct forEach() documentation to match actual implementation
avoidwork Mar 29, 2026
f3de5f0
docs: fix cache-aside example to show shared cache instance
avoidwork Mar 29, 2026
5805bc8
docs: correct comment to say 'TTL reset on update' instead of 'on acc…
avoidwork Mar 29, 2026
ebffa0f
Fix cleanup() memory leak - clear prev/next pointers on expired nodes
avoidwork Mar 29, 2026
52965ad
Fix onEvict() documentation - callback also triggers on direct evict(…
avoidwork Mar 29, 2026
7df06c3
Fix test name - should test peek() during forEach, not get()
avoidwork Mar 29, 2026
75f8b40
Fix documentation inaccuracies
avoidwork Mar 29, 2026
ae5f8cb
Fix clear() memory leak - clear prev/next pointers on all nodes
avoidwork Mar 29, 2026
d1157db
Fix TTL semantics inconsistency - expiry === 0 should be noTTL, not e…
avoidwork Mar 29, 2026
01cfb31
Add #isExpired() private function for DRY TTL expiration check
avoidwork Mar 29, 2026
eadb294
Fix has() TTL semantics - use #isExpired() consistently
avoidwork Mar 29, 2026
470cbdf
docs: consolidate duplicate entries() method descriptions
avoidwork Mar 29, 2026
1ea54ab
docs: fix backticks and add full description to Properties table
avoidwork Mar 29, 2026
15b484f
test: fix forEach delete test title to reflect actual behavior
avoidwork Mar 29, 2026
be91f2c
docs: fix noTTL description in keysByTTL() and sizeByTTL()
avoidwork Mar 29, 2026
0f5ff1e
fix(types): make items property return Record<any, LRUItem<T> | undef…
avoidwork Mar 29, 2026
af1d817
fix: validate onEvict callback is a function before storing
avoidwork Mar 29, 2026
5aa9087
fix: throw TypeError if onEvict callback is not a function
avoidwork Mar 29, 2026
49b4940
test: add onEvict validation tests for non-function callbacks
avoidwork Mar 29, 2026
522ff6b
docs: update coverage metrics to 99.28% branches
avoidwork Mar 29, 2026
8b440cf
docs: add testing and coverage requirements to CODE_STYLE_GUIDE
avoidwork Mar 29, 2026
9fbe54c
chore: build and update coverage metrics to 99.28% branches
avoidwork Mar 29, 2026
762df14
docs: fix clear() time complexity from O(1) to O(n)
avoidwork Mar 29, 2026
f31dadb
docs: fix stats() sets description to include setWithEvicted()
avoidwork Mar 29, 2026
b151f13
docs: Fix stats().deletes description
avoidwork Mar 29, 2026
be0cfaf
docs: Remove nodei.co npm badge
avoidwork Mar 29, 2026
3995ab9
docs: Sort Properties and Methods alphabetically
avoidwork Mar 29, 2026
6440f1e
docs: Sort Methods section alphabetically
avoidwork Mar 29, 2026
feff12b
docs: Update test counts to 149 tests across 26 suites
avoidwork Mar 29, 2026
b027260
docs: Remove GitHub stars badge from README
avoidwork Mar 29, 2026
4d90ed7
docs: Fix lru-cache bundle size from 15 KB to 12 KB
avoidwork Mar 29, 2026
7748307
docs: Fix API.md inaccuracies
avoidwork Mar 29, 2026
5bad7e5
docs: Clarify which build files are shipped via npm
avoidwork Mar 29, 2026
f2fc84b
docs: Document getMany() side effects
avoidwork Mar 29, 2026
4cba0a2
Rename resetTtl to resetTTL for consistent TTL naming
avoidwork Mar 29, 2026
dd492ba
docs: Fix entries() return type to specify 2-element tuple
avoidwork Mar 29, 2026
d175d2e
docs: fix valuesByTTL() noTTL description
avoidwork Mar 29, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
name: ci

on:
push:
branches:
- master
pull_request:
branches:
- master
Expand Down
12 changes: 9 additions & 3 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ Source code is in `src/`.
├── tests/ # Test files
├── benchmarks/ # Performance benchmarks
├── dist/ # Built distribution files
│ ├── tiny-lru.js # ES Modules
│ ├── tiny-lru.cjs # CommonJS
│ └── tiny-lru.min.js # Minified ESM
├── types/ # TypeScript definitions
├── docs/ # Documentation
├── rollup.config.js # Build configuration
Expand All @@ -56,16 +59,19 @@ Source code is in `src/`.

- `lru(max, ttl, resetTtl)` - Factory function to create cache
- `LRU` class - Direct instantiation with `new LRU(max, ttl, resetTtl)`
- Key methods: `get()`, `set()`, `delete()`, `has()`, `clear()`, `evict()`
- Core methods: `get()`, `set()`, `peek()`, `delete()`, `has()`, `clear()`, `evict()`
- Array methods: `keys()`, `values()`, `entries()`
- Utility methods: `forEach()`, `getMany()`, `hasAll()`, `hasAny()`, `cleanup()`, `toJSON()`, `stats()`, `onEvict()`, `sizeByTTL()`, `keysByTTL()`, `valuesByTTL()`
- Properties: `first`, `last`, `max`, `size`, `ttl`, `resetTtl`
- `peek(key)` - Retrieve value without moving it (no LRU update, no TTL check)

## Testing

- Framework: Node.js built-in test runner (`node --test`)
- Coverage: 100%
- Tests: 149 tests across 26 suites
- Coverage: 100% lines, 99.28% branches, 100% functions
- Test pattern: `tests/**/*.js`
- All tests must pass with 100% coverage before merging
- All tests must pass with 100% line coverage before merging
- Run: `npm test` (lint + tests) or `npm run coverage` for coverage report

## Common Issues to Avoid
Expand Down
Loading
Loading