UNPKG

1.36 kBJavaScriptView Raw
1"use strict";
2
3Object.defineProperty(exports, "__esModule", {
4 value: true
5});
6exports.hasWasm = exports.hasProcess = exports.hasEsm = exports.hasDirname = exports.hasCjs = exports.hasBuffer = exports.hasBigInt = void 0;
7
8var _xBigint = require("@polkadot/x-bigint");
9
10// Copyright 2017-2022 @polkadot/util authors & contributors
11// SPDX-License-Identifier: Apache-2.0
12
13/** true if the environment has proper BigInt support */
14const hasBigInt = typeof _xBigint.BigInt === 'function' && typeof _xBigint.BigInt.asIntN === 'function';
15/** true if the environment has support for Buffer */
16
17exports.hasBigInt = hasBigInt;
18const hasBuffer = typeof Buffer !== 'undefined';
19/** true if the environment is CJS */
20
21exports.hasBuffer = hasBuffer;
22const hasCjs = typeof require === 'function' && typeof module !== 'undefined';
23/** true if the environment has __dirname available */
24
25exports.hasCjs = hasCjs;
26const hasDirname = typeof __dirname !== 'undefined';
27/** true if the environment is ESM */
28
29exports.hasDirname = hasDirname;
30const hasEsm = !hasCjs;
31/** true if the environment has process available (typically Node.js) */
32
33exports.hasEsm = hasEsm;
34const hasProcess = typeof process === 'object';
35/** true if the environment has WebAssembly available */
36
37exports.hasProcess = hasProcess;
38const hasWasm = typeof WebAssembly !== 'undefined';
39exports.hasWasm = hasWasm;
\No newline at end of file