ccxt
Version:
42 lines (36 loc) • 2.01 kB
JavaScript
;
Object.defineProperty(exports, '__esModule', { value: true });
// ----------------------------------------------------------------------------
// PLEASE DO NOT EDIT THIS FILE, IT IS GENERATED AND WILL BE OVERWRITTEN:
// https://github.com/ccxt/ccxt/blob/master/CONTRIBUTING.md#how-to-contribute-code
// EDIT THE CORRESPONDENT .ts FILE INSTEAD
// @ts-nocheck
// ----------------------------------------------------------------------------
// There's been a lot of messing with this code...
// The problem is to satisfy the following requirements:
// - properly detect isNode == true on server side and isNode == false in the browser (on client side)
// - make sure create-react-app, react-starter-kit and other react frameworks work
// - make sure it does not break the browserified version (when linked into a html from a cdn)
// - make sure it does not break the rspack bundling and babel-transpiled scripts
// - make sure it works in Electron
// - make sure it works with Angular.js
// - make sure it does not break other possible usage scenarios
const isBrowser = typeof window !== 'undefined';
const isElectron = typeof process !== 'undefined' &&
typeof process.versions !== 'undefined' &&
typeof process.versions.electron !== 'undefined';
const isWebWorker = typeof WorkerGlobalScope !== 'undefined' && (self instanceof WorkerGlobalScope);
const isWindows = typeof process !== 'undefined' && process.platform === "win32";
const isDeno = typeof Deno !== 'undefined';
// bun is node-compatible (isNode stays true there), but its native fetch differs (e.g. built-in `proxy` option)
const isBun = typeof process !== 'undefined' &&
typeof process.versions !== 'undefined' &&
typeof process.versions.bun !== 'undefined';
const isNode = !(isBrowser || isWebWorker || isDeno);
exports.isBrowser = isBrowser;
exports.isBun = isBun;
exports.isDeno = isDeno;
exports.isElectron = isElectron;
exports.isNode = isNode;
exports.isWebWorker = isWebWorker;
exports.isWindows = isWindows;