UNPKG

988 BJavaScriptView Raw
1import { BigInt } from '@polkadot/x-bigint';
2import { xglobal } from '@polkadot/x-global';
3/** true if the environment has proper BigInt support */
4export const hasBigInt = typeof BigInt === 'function' && typeof BigInt.asIntN === 'function';
5/** true if the environment is CJS */
6export const hasCjs = typeof require === 'function' && typeof module !== 'undefined';
7/** true if the environment has __dirname available */
8export const hasDirname = typeof __dirname !== 'undefined';
9/** true if the environment is ESM */
10export const hasEsm = !hasCjs;
11/** true if the environment has WebAssembly available */
12export const hasWasm = typeof WebAssembly !== 'undefined';
13/** true if the environment has support for Buffer (typically Node.js) */
14export const hasBuffer = typeof xglobal.Buffer === 'function' && typeof xglobal.Buffer.isBuffer === 'function';
15/** true if the environment has process available (typically Node.js) */
16export const hasProcess = typeof xglobal.process === 'object';