@sinclair/hammer
Version:
Build Tool for Browser and Node Applications
30 lines (29 loc) • 648 B
TypeScript
export declare type Action<T> = Insert<T> | Update<T> | Delete<T>;
export declare type Insert<T> = {
type: 'insert';
value: T;
};
export declare type Update<T> = {
type: 'update';
value: T;
};
export declare type Delete<T> = {
type: 'delete';
value: T;
};
declare type CacheOptions<T> = {
key: keyof T;
timestamp: keyof T;
};
export declare class Cache<T> {
private readonly options;
private readonly data;
constructor(options: CacheOptions<T>);
private keyOf;
private timestampOf;
private inserts;
private updates;
private deletes;
update(values: T[]): Action<T>[];
}
export {};