UNPKG

darkcord

Version:

A NodeJS Package to interact with Discord API

38 lines 2.12 kB
import { BaseCacheOptions } from "../types/index"; export type CacheEntries<K, V> = Readonly<Readonly<[K, V]>[]> | Iterable<Readonly<[K, V]>>; export declare class Cache<V> extends Map<string, V> { #private; limit: Readonly<number>; constructor(entries?: CacheEntries<string, V>); constructor(entries?: Readonly<Readonly<[string, V]>[]>); constructor(entries?: Iterable<Readonly<[string, V]>>); constructor(limit?: number, entries?: Readonly<Readonly<[string, V]>[]>); constructor(limit?: number, entries?: Readonly<Readonly<[string, V]>[]>); constructor(limit?: number, entries?: Iterable<Readonly<[string, V]>>); constructor(limit?: BaseCacheOptions<V> | number | CacheEntries<string, V>, entries?: CacheEntries<string, V>); constructor(limit?: BaseCacheOptions<V>, entries?: CacheEntries<string, V>); constructor(limit?: BaseCacheOptions<V>, entries?: Readonly<Readonly<[string, V]>[]>); constructor(limit?: BaseCacheOptions<V>, entries?: Iterable<Readonly<[string, V]>>); set(key: string, value: V): this; forEach(fn: (value: V, key: string, cache: Cache<V>) => void): void; filter(fn: (value: V, key: string, cache: Cache<V>) => boolean): Cache<V>; find(fn: (value: V, key: string, cache: Cache<V>) => boolean): [string, V] | undefined; every(fn: (value: V, key: string, cache: Cache<V>) => boolean): boolean; some(fn: (value: V, key: string, cache: Cache<V>) => boolean): boolean; map<MV>(fn: (value: V, key: string, cache: Cache<V>) => { key: string; value: MV; }): Cache<MV>; first(): V; first(amount?: number): V[]; last(): V; last(amount?: number): V[]; at(index: number): V | undefined; reverse(): Cache<V>; indexOf(value: V): number; reduce(fn: (previous: [string, V], current: [string, V]) => [string, V], initialValue: [string, V]): [string, V]; keyOf(value: V): string; sweep(fn: (value: V, key: string, cache: Cache<V>) => boolean): number; partition(fn: (value: V, key: string, cache: Cache<V>) => boolean): [Cache<V>, Cache<V>]; } //# sourceMappingURL=Cache.d.ts.map