deno.land / x / eta@v1.12.3 / storage.ts

storage.ts
View Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import { copyProps } from "./utils.ts";
/** * Handles storage and accessing of values * * In this case, we use it to store compiled template functions * Indexed by their `name` or `filename` */class Cacher<T> { constructor(private cache: Record<string, T>) {} define(key: string, val: T): void { this.cache[key] = val; } get(key: string): T { // string | array. // TODO: allow array of keys to look down // TODO: create plugin to allow referencing helpers, filters with dot notation return this.cache[key]; } remove(key: string): void { delete this.cache[key]; } reset(): void { this.cache = {}; } load(cacheObj: Record<string, T>): void { copyProps(this.cache, cacheObj); }}
export { Cacher };
eta
Embedded JS template engine for Node, Deno, and the browser. Lighweight, fast, and pluggable. Written in TypeScript
DocumentationDocumentation
GitHub Repositoryeta-dev/eta
GitHub Stars
527

Version Info

Tagged at
10 months ago

External Dependencies

1 external dependency