UNPKG

rust-map

Version:

A Rust inspired Map API for JS/TS

20 lines (19 loc) 653 B
declare class Entry<K, V> { private parent; private key; constructor(parent: RustMap<K, V>, key: K); orInsert(defaultValue: V): V; orInsertWith<Args extends any[]>(defaultFn: (...args: Args) => V, ...args: Args): V; orConstruct<Args extends any[]>(ctor: { new (...args: Args): V; }, ...args: Args): V; } export declare class RustMap<K, V> extends Map<K, V> { entry(key: K): Entry<K, V>; /** * Retains only the elements specified by the predicate. * In other words, remove all pairs (k, v) where f(k, v) returns false. */ retain(predicate: (key: K, value: V) => boolean): void; } export {};