This commit is contained in:
2022-10-13 22:06:51 +02:00
parent f1f5e44b54
commit c87fd3eaf5
52 changed files with 2252 additions and 4729 deletions

17
src/utils/base.ts Normal file
View 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()
}