UNPKG

1.24 kBJavaScriptView Raw
1"use strict";
2Object.defineProperty(exports, "__esModule", { value: true });
3exports.hasProcess = exports.hasBuffer = exports.hasWasm = exports.hasEsm = exports.hasDirname = exports.hasCjs = exports.hasBigInt = void 0;
4const x_bigint_1 = require("@polkadot/x-bigint");
5const x_global_1 = require("@polkadot/x-global");
6/** true if the environment has proper BigInt support */
7exports.hasBigInt = typeof x_bigint_1.BigInt === 'function' && typeof x_bigint_1.BigInt.asIntN === 'function';
8/** true if the environment is CJS */
9exports.hasCjs = typeof require === 'function' && typeof module !== 'undefined';
10/** true if the environment has __dirname available */
11exports.hasDirname = typeof __dirname !== 'undefined';
12/** true if the environment is ESM */
13exports.hasEsm = !exports.hasCjs;
14/** true if the environment has WebAssembly available */
15exports.hasWasm = typeof WebAssembly !== 'undefined';
16/** true if the environment has support for Buffer (typically Node.js) */
17exports.hasBuffer = typeof x_global_1.xglobal.Buffer === 'function' && typeof x_global_1.xglobal.Buffer.isBuffer === 'function';
18/** true if the environment has process available (typically Node.js) */
19exports.hasProcess = typeof x_global_1.xglobal.process === 'object';