@pkerschbaum/code-oss-file-service
Version:
VS Code ([microsoft/vscode](https://github.com/microsoft/vscode)) includes a rich "`FileService`" and "`DiskFileSystemProvider`" abstraction built on top of Node.js core modules (`fs`, `path`) and Electron's `shell` module. This package allows to use that
44 lines • 1.62 kB
TypeScript
/**
* An interface for a JavaScript object that
* acts a dictionary. The keys are strings.
*/
export declare type IStringDictionary<V> = Record<string, V>;
/**
* An interface for a JavaScript object that
* acts a dictionary. The keys are numbers.
*/
export declare type INumberDictionary<V> = Record<number, V>;
/**
* Returns an array which contains all values that reside
* in the given dictionary.
*/
export declare function values<T>(from: IStringDictionary<T> | INumberDictionary<T>): T[];
/**
* Iterates over each entry in the provided dictionary. The iterator allows
* to remove elements and will stop when the callback returns {{false}}.
*/
export declare function forEach<T>(from: IStringDictionary<T> | INumberDictionary<T>, callback: (entry: {
key: any;
value: T;
}, remove: () => void) => any): void;
/**
* Groups the collection into a dictionary based on the provided
* group function.
*/
export declare function groupBy<K extends string | number | symbol, V>(data: V[], groupFn: (element: V) => K): Record<K, V[]>;
export declare function fromMap<T>(original: Map<string, T>): IStringDictionary<T>;
export declare function diffSets<T>(before: Set<T>, after: Set<T>): {
removed: T[];
added: T[];
};
export declare function diffMaps<K, V>(before: Map<K, V>, after: Map<K, V>): {
removed: V[];
added: V[];
};
export declare class SetMap<K, V> {
private map;
add(key: K, value: V): void;
delete(key: K, value: V): void;
forEach(key: K, fn: (value: V) => void): void;
}
//# sourceMappingURL=collections.d.ts.map