This commit is contained in:
2022-10-14 17:32:05 +02:00
parent d52f59f709
commit be4e736ffd
9 changed files with 265 additions and 30 deletions

View File

@@ -1,6 +1,13 @@
/**
* @internal
*/
export const isBrowser = typeof window !== 'undefined'
/**
* @internal
*/
export type PromiseOrValue<T> = T | Promise<T>
export type TypedArray =
| Int8Array
| Uint8Array
@@ -12,6 +19,9 @@ export type TypedArray =
| BigInt64Array
| BigUint64Array
/**
* @internal
*/
export function split<T>({ node, browser }: { node: () => T; browser: () => T }) {
return isBrowser ? browser() : node()
}