Skip to content

Commit

Permalink
Require Node.js 18
Browse files Browse the repository at this point in the history
Fixes #46
  • Loading branch information
sindresorhus committed Sep 11, 2023
1 parent b552634 commit f0bbe48
Show file tree
Hide file tree
Showing 7 changed files with 134 additions and 141 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ jobs:
fail-fast: false
matrix:
node-version:
- 14
- 12
- 20
- 18
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
- run: npm install
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
node_modules
yarn.lock
.nyc_output
coverage
17 changes: 9 additions & 8 deletions index.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export interface Options<KeyType, ValueType> {
export type Options<KeyType, ValueType> = {
/**
The maximum number of milliseconds an item should remain in the cache.
Expand All @@ -22,14 +22,10 @@ export interface Options<KeyType, ValueType> {
Useful for side effects or for items like object URLs that need explicit cleanup (`revokeObjectURL`).
*/
onEviction?: (key: KeyType, value: ValueType) => void;
}

export default class QuickLRU<KeyType, ValueType> extends Map implements Iterable<[KeyType, ValueType]> {
/**
The stored item count.
*/
readonly size: number;
};

// eslint-disable-next-line @typescript-eslint/naming-convention
export default class QuickLRU<KeyType, ValueType> extends Map<KeyType, ValueType> implements Iterable<[KeyType, ValueType]> {
/**
Simple ["Least Recently Used" (LRU) cache](https://en.m.wikipedia.org/wiki/Cache_replacement_policies#Least_Recently_Used_.28LRU.29).
Expand Down Expand Up @@ -101,6 +97,11 @@ export default class QuickLRU<KeyType, ValueType> extends Map implements Iterabl
*/
resize(maxSize: number): void;

/**
The stored item count.
*/
get size(): number;

/**
Iterable for all the keys.
*/
Expand Down
Loading

0 comments on commit f0bbe48

Please sign in to comment.