@polygonjs/polygonjs
Version:
node-based WebGL 3D engine https://polygonjs.com
27 lines (26 loc) • 1.91 kB
TypeScript
type GroupByCallback<T, K> = (arg: T) => K;
export declare function mapFirstKey<K>(map: Map<K, any>): K | undefined;
export declare function pushOnArrayAtEntry<K, V>(map: Map<K, V[]>, key: K, newElement: V): void;
export declare function popFromArrayAtEntry<K, V>(map: Map<K, V[]>, key: K, elementToRemove: V, removeFromMapIfEmpty?: boolean): void;
export declare function addToSetAtEntry<K, V>(map: Map<K, Set<V>>, key: K, newElement: V): void;
export declare function addToMapAtEntry<K0, K1, V>(map: Map<K0, Map<K1, V>>, key0: K0, key1: K1, newElement: V): void;
export declare function getMapElementAtEntry<K0, K1, V>(map: Map<K0, Map<K1, V>>, key0: K0, key1: K1): V | undefined;
export declare function mapValuesToArray<K, V>(map: Map<K, V>, target: Array<V>): Array<V>;
export declare function removeFromSetAtEntry<K, V>(map: Map<K, Set<V>>, key: K, elementToRemove: V): void;
export declare function unshiftOnArrayAtEntry<K, V>(map: Map<K, V[]>, key: K, newElement: V): void;
export declare function concatOnArrayAtEntry<K, V>(map: Map<K, V[]>, key: K, newElements: V[]): void;
export declare function mapGroupBy<T, K>(array: readonly T[], callback: GroupByCallback<T, K>): Map<K, T[]>;
export declare function mapIncrementAtEntry<K>(map: Map<K, number>, key: K, initValue: number): number;
export declare function mapEntriesCount<K, V>(map: Map<K, V>): number;
export declare class MapUtils {
static pushOnArrayAtEntry: typeof pushOnArrayAtEntry;
static addToSetAtEntry: typeof addToSetAtEntry;
static popFromArrayAtEntry: typeof popFromArrayAtEntry;
static removeFromSetAtEntry: typeof removeFromSetAtEntry;
static unshiftOnArrayAtEntry: typeof unshiftOnArrayAtEntry;
static concatOnArrayAtEntry: typeof concatOnArrayAtEntry;
static groupBy: typeof mapGroupBy;
static incrementAtEntry: typeof mapIncrementAtEntry;
static firstKey: typeof mapFirstKey;
}
export {};