mirror of
https://github.com/cupcakearmy/occulto.git
synced 2025-09-11 05:30:40 +00:00
2.0.0 (#3)
* rewrite * testing worklflow * sprcify version * config stuff * add hash as buffer * delete docs * use typedarray everywhere and docs * readme * aes * cleanup * rsa * testing with playwright * fix playwright * readme * docs * update deps * use headless * add prepublish * build pipeline * move types up * move types up * add types legacy * packaging * versions bump * cleanup * maybe this time * drop support for commonjs * version bump * cleanup
This commit is contained in:
27
src/utils/base.ts
Normal file
27
src/utils/base.ts
Normal file
@@ -0,0 +1,27 @@
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
export const isBrowser = typeof window !== 'undefined'
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
export type PromiseOrValue<T> = T | Promise<T>
|
||||
|
||||
export type TypedArray =
|
||||
| Int8Array
|
||||
| Uint8Array
|
||||
| Uint8ClampedArray
|
||||
| Int16Array
|
||||
| Uint16Array
|
||||
| Int32Array
|
||||
| Uint32Array
|
||||
| BigInt64Array
|
||||
| BigUint64Array
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
export function split<T>({ node, browser }: { node: () => T; browser: () => T }) {
|
||||
return isBrowser ? browser() : node()
|
||||
}
|
Reference in New Issue
Block a user