mirror of
https://github.com/pezkuwichain/pezkuwi-common.git
synced 2026-04-22 09:08:03 +00:00
Initial rebrand: @polkadot -> @pezkuwi (14 packages)
- Package namespace: @polkadot/* -> @pezkuwi/* - Repository: polkadot-js/common -> pezkuwichain/pezkuwi-common - Author: Pezkuwi Team <team@pezkuwichain.io> Core packages: - @pezkuwi/util (utilities) - @pezkuwi/util-crypto (crypto primitives) - @pezkuwi/keyring (account management) - @pezkuwi/networks (chain metadata) - @pezkuwi/hw-ledger (Ledger hardware wallet) - @pezkuwi/x-* (10 polyfill packages) Total: 14 packages Upstream: polkadot-js/common v14.0.1
This commit is contained in:
@@ -0,0 +1,38 @@
|
||||
// Copyright 2017-2025 @polkadot/util authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import type { BufferClass } from './types.js';
|
||||
|
||||
import { BigInt } from '@pezkuwi/x-bigint';
|
||||
import { xglobal } from '@pezkuwi/x-global';
|
||||
|
||||
// Since we run in very different environments, we have to ensure we have all
|
||||
// the types used here for detection (some of these may require Node definitions,
|
||||
// which are not available in Deno/browser)
|
||||
declare const __dirname: unknown;
|
||||
declare const module: unknown;
|
||||
declare const require: unknown;
|
||||
|
||||
/** true if the environment has proper BigInt support */
|
||||
export const hasBigInt = typeof BigInt === 'function' && typeof BigInt.asIntN === 'function';
|
||||
|
||||
/** true if the environment is CJS */
|
||||
export const hasCjs = typeof require === 'function' && typeof module !== 'undefined';
|
||||
|
||||
/** true if the environment has __dirname available */
|
||||
export const hasDirname = typeof __dirname !== 'undefined';
|
||||
|
||||
/** true if the environment is ESM */
|
||||
export const hasEsm = !hasCjs;
|
||||
|
||||
/** true if the environment has WebAssembly available */
|
||||
export const hasWasm = typeof WebAssembly !== 'undefined';
|
||||
|
||||
// NOTE We check the following on globalThis, avoiding specific polyfill detection
|
||||
// that some bundlers such as parcel would add (this is a check, not a use)
|
||||
|
||||
/** true if the environment has support for Buffer (typically Node.js) */
|
||||
export const hasBuffer = typeof xglobal.Buffer === 'function' && typeof (xglobal.Buffer as unknown as BufferClass).isBuffer === 'function';
|
||||
|
||||
/** true if the environment has process available (typically Node.js) */
|
||||
export const hasProcess = typeof xglobal.process === 'object';
|
||||
Reference in New Issue
Block a user