@ts-for-gir/lib
Version:
Typescript .d.ts generator from GIR for gjs
21 lines (20 loc) • 611 B
TypeScript
/**
* A simple two-key map.
*/
export declare class TwoKeyMap<K1, K2, V> {
private baseMap;
forEach(op: (v: V) => void): void;
has(key1: K1, key2: K2): boolean;
getIfOnly(key1: K1): readonly [K2, V] | undefined;
get(key1: K1, key2: K2): V | undefined;
set(key1: K1, key2: K2, value: V): void;
}
/**
* If the predicate returns a value other than undefined,
* that value is returned. It combines the .find() and
* .map() APIs for convenience.
*
* @param arr
* @param predicate
*/
export declare function findMap<T, K>(arr: T[], predicate: (p: T) => K | undefined): K | undefined;