nookipedia › Globals › "cache" › Cache
This is a simple class that extends off of the Map class, it uses a string similarity algorithm to try and find an object, rather than just using the exact given string to retrieve.
▪ Type
-
Map‹string, Type›
↳ Cache
+ new Cache(): Cache
Defined in src/cache.ts:9
Initializes a new Cache instance.
Returns: Cache
• [Symbol.toStringTag]: string
Inherited from Cache.[Symbol.toStringTag]
Defined in node_modules/.pnpm/registry.npmjs.org/typescript/3.9.2/node_modules/typescript/lib/lib.es2015.symbol.wellknown.d.ts:130
• size: number
Defined in node_modules/.pnpm/registry.npmjs.org/typescript/3.9.2/node_modules/typescript/lib/lib.es2015.collection.d.ts:28
▪ Map: MapConstructor
Defined in node_modules/.pnpm/registry.npmjs.org/typescript/3.9.2/node_modules/typescript/lib/lib.es2015.collection.d.ts:36
▸ [Symbol.iterator](): IterableIterator‹[string, Type]›
Inherited from Cache.[Symbol.iterator]
Defined in node_modules/.pnpm/registry.npmjs.org/typescript/3.9.2/node_modules/typescript/lib/lib.es2015.iterable.d.ts:121
Returns an iterable of entries in the map.
Returns: IterableIterator‹[string, Type]›
▸ clear(): void
Defined in node_modules/.pnpm/registry.npmjs.org/typescript/3.9.2/node_modules/typescript/lib/lib.es2015.collection.d.ts:22
Returns: void
▸ delete(key
: string): boolean
Defined in node_modules/.pnpm/registry.npmjs.org/typescript/3.9.2/node_modules/typescript/lib/lib.es2015.collection.d.ts:23
Parameters:
Name | Type |
---|---|
key |
string |
Returns: boolean
▸ entries(): IterableIterator‹[string, Type]›
Defined in node_modules/.pnpm/registry.npmjs.org/typescript/3.9.2/node_modules/typescript/lib/lib.es2015.iterable.d.ts:126
Returns an iterable of key, value pairs for every entry in the map.
Returns: IterableIterator‹[string, Type]›
▸ find(name
: string): Type | null
Defined in src/cache.ts:42
Tries to find the given name in the map and returns its entry as the generic type, if an entry can't be found null is returned.
Parameters:
Name | Type | Description |
---|---|---|
name |
string | The entry to look for. |
Returns: Type | null
The entry for the given name if it exists, otherwise, null.
▸ forEach(callbackfn
: function, thisArg?
: any): void
Defined in node_modules/.pnpm/registry.npmjs.org/typescript/3.9.2/node_modules/typescript/lib/lib.es2015.collection.d.ts:24
Parameters:
▪ callbackfn: function
▸ (value
: Type, key
: string, map
: Map‹string, Type›): void
Parameters:
Name | Type |
---|---|
value |
Type |
key |
string |
map |
Map‹string, Type› |
▪Optional
thisArg: any
Returns: void
▸ get(key
: string): Type | undefined
Defined in node_modules/.pnpm/registry.npmjs.org/typescript/3.9.2/node_modules/typescript/lib/lib.es2015.collection.d.ts:25
Parameters:
Name | Type |
---|---|
key |
string |
Returns: Type | undefined
▸ has(name
: string): boolean
Overrides void
Defined in src/cache.ts:32
Determines if the given name exists within this map.
Parameters:
Name | Type | Description |
---|---|---|
name |
string | The string to look for. |
Returns: boolean
Represents if the given string has an entry in this map.
▸ keys(): IterableIterator‹string›
Defined in node_modules/.pnpm/registry.npmjs.org/typescript/3.9.2/node_modules/typescript/lib/lib.es2015.iterable.d.ts:131
Returns an iterable of keys in the map
Returns: IterableIterator‹string›
▸ matches(name
: string): string[]
Defined in src/cache.ts:23
Searches through the Map's data and executes a string similarity method to try and find an entry.
Parameters:
Name | Type | Description |
---|---|---|
name |
string | The name of the entry to find. |
Returns: string[]
An array of possible matches.
▸ set(key
: string, value
: Type): this
Defined in node_modules/.pnpm/registry.npmjs.org/typescript/3.9.2/node_modules/typescript/lib/lib.es2015.collection.d.ts:27
Parameters:
Name | Type |
---|---|
key |
string |
value |
Type |
Returns: this
▸ values(): IterableIterator‹Type›
Defined in node_modules/.pnpm/registry.npmjs.org/typescript/3.9.2/node_modules/typescript/lib/lib.es2015.iterable.d.ts:136
Returns an iterable of values in the map
Returns: IterableIterator‹Type›