MCPcopy
hub / github.com/ulid/javascript / detectRoot

Function detectRoot

source/ulid.ts:65–77  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

63}
64
65function detectRoot(): any {
66 if (inWebWorker()) return self;
67 if (typeof window !== "undefined") {
68 return window;
69 }
70 if (typeof global !== "undefined") {
71 return global;
72 }
73 if (typeof globalThis !== "undefined") {
74 return globalThis;
75 }
76 return null;
77}
78
79export function encodeRandom(len: number, prng: PRNG): string {
80 let str = "";

Callers 1

detectPRNGFunction · 0.85

Calls 1

inWebWorkerFunction · 0.85

Tested by

no test coverage detected