wave-roll
Version:
JavaScript Library for Comparative MIDI Piano-Roll Visualization
77 lines • 1.97 kB
TypeScript
/**
* Record/Map operations for state management
*/
/**
* Manager for Record-based collections (e.g., file handlers)
*/
export declare class RecordManager<T> {
private record;
private onUpdate?;
constructor(initialRecord?: Record<string, T>, onUpdate?: (record: Record<string, T>) => void);
/**
* Set a value in the record
*/
set(key: string, value: T): void;
/**
* Get a value from the record
*/
get(key: string): T | undefined;
/**
* Remove a key from the record
*/
remove(key: string): void;
/**
* Check if a key exists
*/
has(key: string): boolean;
/**
* Clear all entries
*/
clear(): void;
/**
* Get all keys
*/
keys(): string[];
/**
* Get all values
*/
values(): T[];
/**
* Get all entries
*/
entries(): [string, T][];
/**
* Iterate over all values
*/
forEach(callback: (value: T, key: string) => void): void;
/**
* Apply a function to all values
*/
mapValues<U>(mapper: (value: T, key: string) => U): Record<string, U>;
/**
* Filter entries
*/
filter(predicate: (value: T, key: string) => boolean): Record<string, T>;
/**
* Get the underlying record (immutable copy)
*/
toRecord(): Record<string, T>;
/**
* Get the number of entries
*/
get size(): number;
private notifyUpdate;
}
/**
* Helper to merge multiple records
*/
export declare function mergeRecords<T>(...records: Record<string, T>[]): Record<string, T>;
/**
* Helper to filter a record
*/
export declare function filterRecord<T>(record: Record<string, T>, predicate: (value: T, key: string) => boolean): Record<string, T>;
/**
* Helper to map record values
*/
export declare function mapRecordValues<T, U>(record: Record<string, T>, mapper: (value: T, key: string) => U): Record<string, U>;
//# sourceMappingURL=record-operations.d.ts.map