mirror of
https://github.com/coder/code-server.git
synced 2026-06-23 02:17:11 +02:00
chore(vscode): update to 1.56.0
This commit is contained in:
@@ -66,6 +66,24 @@ export function groupBy<T>(data: T[], groupFn: (element: T) => string): IStringD
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Groups the collection into a dictionary based on the provided
|
||||
* group function.
|
||||
*/
|
||||
export function groupByNumber<T>(data: T[], groupFn: (element: T) => number): Map<number, T[]> {
|
||||
const result = new Map<number, T[]>();
|
||||
for (const element of data) {
|
||||
const key = groupFn(element);
|
||||
let target = result.get(key);
|
||||
if (!target) {
|
||||
target = [];
|
||||
result.set(key, target);
|
||||
}
|
||||
target.push(element);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
export function fromMap<T>(original: Map<string, T>): IStringDictionary<T> {
|
||||
const result: IStringDictionary<T> = Object.create(null);
|
||||
if (original) {
|
||||
|
||||
Reference in New Issue
Block a user