mirror of
https://github.com/excalidraw/excalidraw.git
synced 2025-05-03 10:00:07 -04:00
fix: check if process is defined before using so it works in browser (#4497)
* refactor: use isTestEnv() utils where applicable * check if process is defined
This commit is contained in:
parent
38236bc5e0
commit
11396a21de
3 changed files with 7 additions and 7 deletions
|
@ -1,5 +1,6 @@
|
|||
import { Random } from "roughjs/bin/math";
|
||||
import { nanoid } from "nanoid";
|
||||
import { isTestEnv } from "./utils";
|
||||
|
||||
let random = new Random(Date.now());
|
||||
let testIdBase = 0;
|
||||
|
@ -11,5 +12,4 @@ export const reseed = (seed: number) => {
|
|||
testIdBase = 0;
|
||||
};
|
||||
|
||||
export const randomId = () =>
|
||||
process.env.NODE_ENV === "test" ? `id${testIdBase++}` : nanoid();
|
||||
export const randomId = () => (isTestEnv() ? `id${testIdBase++}` : nanoid());
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue