mirror of
https://github.com/cupcakearmy/occulto.git
synced 2025-12-16 08:54:59 +00:00
rewrite
This commit is contained in:
17
src/utils/base.ts
Normal file
17
src/utils/base.ts
Normal file
@@ -0,0 +1,17 @@
|
||||
export const isBrowser = typeof window !== 'undefined'
|
||||
|
||||
export type PromiseOrValue<T> = T | Promise<T>
|
||||
export type TypedArray =
|
||||
| Int8Array
|
||||
| Uint8Array
|
||||
| Uint8ClampedArray
|
||||
| Int16Array
|
||||
| Uint16Array
|
||||
| Int32Array
|
||||
| Uint32Array
|
||||
| BigInt64Array
|
||||
| BigUint64Array
|
||||
|
||||
export function split<T>({ node, browser }: { node: () => T; browser: () => T }) {
|
||||
return isBrowser ? browser() : node()
|
||||
}
|
||||
Reference in New Issue
Block a user