mirror of
https://github.com/excalidraw/excalidraw.git
synced 2025-05-03 10:00:07 -04:00
feat: multiplayer undo / redo (#7348)
This commit is contained in:
parent
5211b003b8
commit
530617be90
71 changed files with 34885 additions and 14877 deletions
|
@ -671,6 +671,18 @@ export const arrayToMapWithIndex = <T extends { id: string }>(
|
|||
return acc;
|
||||
}, new Map<string, [element: T, index: number]>());
|
||||
|
||||
/**
|
||||
* Transform array into an object, use only when array order is irrelevant.
|
||||
*/
|
||||
export const arrayToObject = <T>(
|
||||
array: readonly T[],
|
||||
groupBy?: (value: T) => string,
|
||||
) =>
|
||||
array.reduce((acc, value) => {
|
||||
acc[groupBy ? groupBy(value) : String(value)] = value;
|
||||
return acc;
|
||||
}, {} as { [key: string]: T });
|
||||
|
||||
export const isTestEnv = () => import.meta.env.MODE === "test";
|
||||
|
||||
export const isDevEnv = () => import.meta.env.MODE === "development";
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue