Skip to content

Commit

Permalink
build(cache): remove transducers dependency
Browse files Browse the repository at this point in the history
  • Loading branch information
postspectacular committed Jul 20, 2024
1 parent e392e7d commit 17fc172
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 10 deletions.
3 changes: 1 addition & 2 deletions packages/cache/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,7 @@
},
"dependencies": {
"@thi.ng/api": "^8.11.6",
"@thi.ng/dcons": "^3.2.118",
"@thi.ng/transducers": "^9.0.10"
"@thi.ng/dcons": "^3.2.118"
},
"devDependencies": {
"@microsoft/api-extractor": "^7.47.0",
Expand Down
13 changes: 6 additions & 7 deletions packages/cache/src/lru.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import type { Fn0, Maybe, Nullable } from "@thi.ng/api";
import type { ConsCell } from "@thi.ng/dcons";
import { DCons } from "@thi.ng/dcons/dcons";
import { map } from "@thi.ng/transducers/map";
import type { CacheEntry, CacheOpts, ICache } from "./api.js";

export class LRUCache<K, V> implements ICache<K, V> {
Expand Down Expand Up @@ -43,16 +42,16 @@ export class LRUCache<K, V> implements ICache<K, V> {
return this.entries();
}

entries(): IterableIterator<Readonly<[K, CacheEntry<K, V>]>> {
return map((e) => <[K, CacheEntry<K, V>]>[e.k, e], this.items);
*entries(): IterableIterator<Readonly<[K, CacheEntry<K, V>]>> {
for (let e of this.items) yield <[K, CacheEntry<K, V>]>[e.k, e];
}

keys(): IterableIterator<Readonly<K>> {
return map((e) => e.k, this.items);
*keys(): IterableIterator<Readonly<K>> {
for (let e of this.items) yield e.k;
}

values(): IterableIterator<Readonly<V>> {
return map((e) => e.v, this.items);
*values(): IterableIterator<Readonly<V>> {
for (let e of this.items) yield e.v;
}

copy(): ICache<K, V> {
Expand Down
1 change: 0 additions & 1 deletion yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -4071,7 +4071,6 @@ __metadata:
"@microsoft/api-extractor": "npm:^7.47.0"
"@thi.ng/api": "npm:^8.11.6"
"@thi.ng/dcons": "npm:^3.2.118"
"@thi.ng/transducers": "npm:^9.0.10"
esbuild: "npm:^0.23.0"
typedoc: "npm:^0.26.3"
typescript: "npm:^5.5.3"
Expand Down

0 comments on commit 17fc172

Please sign in to comment.