@polkadot/util
Advanced tools
Comparing version 10.1.14 to 10.2.1
@@ -10,3 +10,3 @@ // Copyright 2017-2022 @polkadot/util authors & contributors | ||
*/ | ||
export const nMax = createCmp((a, b) => a > b); | ||
export const nMax = /*#__PURE__*/createCmp((a, b) => a > b); | ||
@@ -17,2 +17,2 @@ /** | ||
*/ | ||
export const nMin = createCmp((a, b) => a < b); | ||
export const nMin = /*#__PURE__*/createCmp((a, b) => a < b); |
@@ -18,3 +18,3 @@ // Copyright 2017-2022 @polkadot/util authors & contributors | ||
*/ | ||
export const bnMax = createCmp((a, b) => a.gt(b)); | ||
export const bnMax = /*#__PURE__*/createCmp((a, b) => a.gt(b)); | ||
@@ -34,2 +34,2 @@ /** | ||
*/ | ||
export const bnMin = createCmp((a, b) => a.lt(b)); | ||
export const bnMin = /*#__PURE__*/createCmp((a, b) => a.lt(b)); |
@@ -15,3 +15,3 @@ "use strict"; | ||
*/ | ||
const nMax = (0, _helpers.createCmp)((a, b) => a > b); | ||
const nMax = /*#__PURE__*/(0, _helpers.createCmp)((a, b) => a > b); | ||
@@ -23,3 +23,3 @@ /** | ||
exports.nMax = nMax; | ||
const nMin = (0, _helpers.createCmp)((a, b) => a < b); | ||
const nMin = /*#__PURE__*/(0, _helpers.createCmp)((a, b) => a < b); | ||
exports.nMin = nMin; |
@@ -24,3 +24,3 @@ "use strict"; | ||
*/ | ||
const bnMax = (0, _helpers.createCmp)((a, b) => a.gt(b)); | ||
const bnMax = /*#__PURE__*/(0, _helpers.createCmp)((a, b) => a.gt(b)); | ||
@@ -41,3 +41,3 @@ /** | ||
exports.bnMax = bnMax; | ||
const bnMin = (0, _helpers.createCmp)((a, b) => a.lt(b)); | ||
const bnMin = /*#__PURE__*/(0, _helpers.createCmp)((a, b) => a.lt(b)); | ||
exports.bnMin = bnMin; |
@@ -8,2 +8,3 @@ "use strict"; | ||
var _xBigint = require("@polkadot/x-bigint"); | ||
var _xGlobal = require("@polkadot/x-global"); | ||
// Copyright 2017-2022 @polkadot/util authors & contributors | ||
@@ -15,8 +16,4 @@ // SPDX-License-Identifier: Apache-2.0 | ||
/** true if the environment has support for Buffer */ | ||
/** true if the environment is CJS */ | ||
exports.hasBigInt = hasBigInt; | ||
const hasBuffer = typeof Buffer !== 'undefined'; | ||
/** true if the environment is CJS */ | ||
exports.hasBuffer = hasBuffer; | ||
const hasCjs = typeof require === 'function' && typeof module !== 'undefined'; | ||
@@ -32,9 +29,16 @@ | ||
/** true if the environment has process available (typically Node.js) */ | ||
/** true if the environment has WebAssembly available */ | ||
exports.hasEsm = hasEsm; | ||
const hasProcess = typeof process === 'object'; | ||
const hasWasm = typeof WebAssembly !== 'undefined'; | ||
/** true if the environment has WebAssembly available */ | ||
exports.hasProcess = hasProcess; | ||
const hasWasm = typeof WebAssembly !== 'undefined'; | ||
exports.hasWasm = hasWasm; | ||
// 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) */ | ||
exports.hasWasm = hasWasm; | ||
const hasBuffer = typeof _xGlobal.xglobal.Buffer !== 'undefined'; | ||
/** true if the environment has process available (typically Node.js) */ | ||
exports.hasBuffer = hasBuffer; | ||
const hasProcess = typeof _xGlobal.xglobal.process === 'object'; | ||
exports.hasProcess = hasProcess; |
@@ -11,6 +11,6 @@ "use strict"; | ||
const checkCodec = (0, _helpers.isOnObject)('toHex', 'toU8a'); | ||
const checkRegistry = (0, _helpers.isOnObject)('get'); | ||
const checkCodec = /*#__PURE__*/(0, _helpers.isOnObject)('toHex', 'toU8a'); | ||
const checkRegistry = /*#__PURE__*/(0, _helpers.isOnObject)('get'); | ||
function isCodec(value) { | ||
return checkCodec(value) && checkRegistry(value.registry); | ||
} |
@@ -15,3 +15,3 @@ "use strict"; | ||
*/ | ||
const isCompact = (0, _helpers.isOnObject)('toBigInt', 'toBn', 'toNumber', 'unwrap'); | ||
const isCompact = /*#__PURE__*/(0, _helpers.isOnObject)('toBigInt', 'toBn', 'toNumber', 'unwrap'); | ||
exports.isCompact = isCompact; |
@@ -25,3 +25,3 @@ "use strict"; | ||
*/ | ||
const isObservable = (0, _helpers.isOn)('next'); | ||
const isObservable = /*#__PURE__*/(0, _helpers.isOn)('next'); | ||
exports.isObservable = isObservable; |
@@ -11,3 +11,3 @@ "use strict"; | ||
const isPromise = (0, _helpers.isOnObject)('catch', 'then'); | ||
const isPromise = /*#__PURE__*/(0, _helpers.isOnObject)('catch', 'then'); | ||
exports.isPromise = isPromise; |
@@ -11,3 +11,3 @@ "use strict"; | ||
const isToBigInt = (0, _helpers.isOn)('toBigInt'); | ||
const isToBigInt = /*#__PURE__*/(0, _helpers.isOn)('toBigInt'); | ||
exports.isToBigInt = isToBigInt; |
@@ -11,3 +11,3 @@ "use strict"; | ||
const isToBn = (0, _helpers.isOn)('toBn'); | ||
const isToBn = /*#__PURE__*/(0, _helpers.isOn)('toBn'); | ||
exports.isToBn = isToBn; |
@@ -8,2 +8,3 @@ "use strict"; | ||
exports.loggerFormat = loggerFormat; | ||
var _xGlobal = require("@polkadot/x-global"); | ||
var _formatDate = require("./format/formatDate"); | ||
@@ -85,3 +86,3 @@ var _bn = require("./is/bn"); | ||
function parseEnv(type) { | ||
const env = (_has.hasProcess ? process : {}).env || {}; | ||
const env = (_has.hasProcess ? _xGlobal.xglobal.process : {}).env || {}; | ||
const maxSize = parseInt(env.DEBUG_MAX || '-1', 10); | ||
@@ -88,0 +89,0 @@ return [getDebugFlag((env.DEBUG || '').toLowerCase().split(','), type), isNaN(maxSize) ? -1 : maxSize]; |
@@ -16,4 +16,4 @@ "use strict"; | ||
type: 'cjs', | ||
version: '10.1.14' | ||
version: '10.2.1' | ||
}; | ||
exports.packageInfo = packageInfo; |
@@ -68,3 +68,3 @@ "use strict"; | ||
*/ | ||
const stringCamelCase = converter((w, i) => | ||
const stringCamelCase = /*#__PURE__*/converter((w, i) => | ||
// lowercase for first letter/first word, else uppercase first, rest unchanged | ||
@@ -78,5 +78,5 @@ (i ? CC_TO_UP[w.charCodeAt(0)] : CC_TO_LO[w.charCodeAt(0)]) + w.slice(1)); | ||
exports.stringCamelCase = stringCamelCase; | ||
const stringPascalCase = converter(w => | ||
const stringPascalCase = /*#__PURE__*/converter(w => | ||
// uppercase the first character, leave the rest unchanged | ||
CC_TO_UP[w.charCodeAt(0)] + w.slice(1)); | ||
exports.stringPascalCase = stringPascalCase; |
@@ -30,3 +30,3 @@ "use strict"; | ||
*/ | ||
const stringLowerFirst = converter(_camelCase.CC_TO_LO); | ||
const stringLowerFirst = /*#__PURE__*/converter(_camelCase.CC_TO_LO); | ||
@@ -48,3 +48,3 @@ /** | ||
exports.stringLowerFirst = stringLowerFirst; | ||
const stringUpperFirst = converter(_camelCase.CC_TO_UP); | ||
const stringUpperFirst = /*#__PURE__*/converter(_camelCase.CC_TO_UP); | ||
exports.stringUpperFirst = stringUpperFirst; |
/** true if the environment has proper BigInt support */ | ||
export declare const hasBigInt: boolean; | ||
/** true if the environment has support for Buffer */ | ||
export declare const hasBuffer: boolean; | ||
/** true if the environment is CJS */ | ||
@@ -11,5 +9,7 @@ export declare const hasCjs: boolean; | ||
export declare const hasEsm: boolean; | ||
/** true if the environment has WebAssembly available */ | ||
export declare const hasWasm: boolean; | ||
/** true if the environment has support for Buffer (typically Node.js) */ | ||
export declare const hasBuffer: boolean; | ||
/** true if the environment has process available (typically Node.js) */ | ||
export declare const hasProcess: boolean; | ||
/** true if the environment has WebAssembly available */ | ||
export declare const hasWasm: boolean; |
18
has.js
@@ -5,2 +5,3 @@ // Copyright 2017-2022 @polkadot/util authors & contributors | ||
import { BigInt } from '@polkadot/x-bigint'; | ||
import { xglobal } from '@polkadot/x-global'; | ||
@@ -14,5 +15,2 @@ // Since we run in very different environments, we have to ensure we have all | ||
/** true if the environment has support for Buffer */ | ||
export const hasBuffer = typeof Buffer !== 'undefined'; | ||
/** true if the environment is CJS */ | ||
@@ -27,6 +25,12 @@ export const hasCjs = typeof require === 'function' && typeof module !== 'undefined'; | ||
/** 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 !== 'undefined'; | ||
/** true if the environment has process available (typically Node.js) */ | ||
export const hasProcess = typeof process === 'object'; | ||
/** true if the environment has WebAssembly available */ | ||
export const hasWasm = typeof WebAssembly !== 'undefined'; | ||
export const hasProcess = typeof xglobal.process === 'object'; |
@@ -5,6 +5,6 @@ // Copyright 2017-2022 @polkadot/util authors & contributors | ||
import { isOnObject } from "./helpers.js"; | ||
const checkCodec = isOnObject('toHex', 'toU8a'); | ||
const checkRegistry = isOnObject('get'); | ||
const checkCodec = /*#__PURE__*/isOnObject('toHex', 'toU8a'); | ||
const checkRegistry = /*#__PURE__*/isOnObject('get'); | ||
export function isCodec(value) { | ||
return checkCodec(value) && checkRegistry(value.registry); | ||
} |
@@ -9,2 +9,2 @@ // Copyright 2017-2022 @polkadot/util authors & contributors | ||
*/ | ||
export const isCompact = isOnObject('toBigInt', 'toBn', 'toNumber', 'unwrap'); | ||
export const isCompact = /*#__PURE__*/isOnObject('toBigInt', 'toBn', 'toNumber', 'unwrap'); |
@@ -20,2 +20,2 @@ // Copyright 2017-2022 @polkadot/util authors & contributors | ||
*/ | ||
export const isObservable = isOn('next'); | ||
export const isObservable = /*#__PURE__*/isOn('next'); |
@@ -5,2 +5,2 @@ // Copyright 2017-2022 @polkadot/util authors & contributors | ||
import { isOnObject } from "./helpers.js"; | ||
export const isPromise = isOnObject('catch', 'then'); | ||
export const isPromise = /*#__PURE__*/isOnObject('catch', 'then'); |
@@ -5,2 +5,2 @@ // Copyright 2017-2022 @polkadot/util authors & contributors | ||
import { isOn } from "./helpers.js"; | ||
export const isToBigInt = isOn('toBigInt'); | ||
export const isToBigInt = /*#__PURE__*/isOn('toBigInt'); |
@@ -5,2 +5,2 @@ // Copyright 2017-2022 @polkadot/util authors & contributors | ||
import { isOn } from "./helpers.js"; | ||
export const isToBn = isOn('toBn'); | ||
export const isToBn = /*#__PURE__*/isOn('toBn'); |
// Copyright 2017-2022 @polkadot/util authors & contributors | ||
// SPDX-License-Identifier: Apache-2.0 | ||
import { xglobal } from '@polkadot/x-global'; | ||
import { formatDate } from "./format/formatDate.js"; | ||
@@ -76,3 +77,3 @@ import { isBn } from "./is/bn.js"; | ||
function parseEnv(type) { | ||
const env = (hasProcess ? process : {}).env || {}; | ||
const env = (hasProcess ? xglobal.process : {}).env || {}; | ||
const maxSize = parseInt(env.DEBUG_MAX || '-1', 10); | ||
@@ -79,0 +80,0 @@ return [getDebugFlag((env.DEBUG || '').toLowerCase().split(','), type), isNaN(maxSize) ? -1 : maxSize]; |
@@ -23,3 +23,3 @@ { | ||
"type": "module", | ||
"version": "10.1.14", | ||
"version": "10.2.1", | ||
"main": "./cjs/index.js", | ||
@@ -722,7 +722,7 @@ "module": "./index.js", | ||
"dependencies": { | ||
"@babel/runtime": "^7.20.1", | ||
"@polkadot/x-bigint": "10.1.14", | ||
"@polkadot/x-global": "10.1.14", | ||
"@polkadot/x-textdecoder": "10.1.14", | ||
"@polkadot/x-textencoder": "10.1.14", | ||
"@babel/runtime": "^7.20.6", | ||
"@polkadot/x-bigint": "10.2.1", | ||
"@polkadot/x-global": "10.2.1", | ||
"@polkadot/x-textdecoder": "10.2.1", | ||
"@polkadot/x-textencoder": "10.2.1", | ||
"@types/bn.js": "^5.1.1", | ||
@@ -729,0 +729,0 @@ "bn.js": "^5.2.1" |
@@ -10,3 +10,3 @@ // Copyright 2017-2022 @polkadot/util authors & contributors | ||
type: 'esm', | ||
version: '10.1.14' | ||
version: '10.2.1' | ||
}; |
@@ -60,3 +60,3 @@ // Copyright 2017-2022 @polkadot/util authors & contributors | ||
*/ | ||
export const stringCamelCase = converter((w, i) => | ||
export const stringCamelCase = /*#__PURE__*/converter((w, i) => | ||
// lowercase for first letter/first word, else uppercase first, rest unchanged | ||
@@ -69,4 +69,4 @@ (i ? CC_TO_UP[w.charCodeAt(0)] : CC_TO_LO[w.charCodeAt(0)]) + w.slice(1)); | ||
*/ | ||
export const stringPascalCase = converter(w => | ||
export const stringPascalCase = /*#__PURE__*/converter(w => | ||
// uppercase the first character, leave the rest unchanged | ||
CC_TO_UP[w.charCodeAt(0)] + w.slice(1)); |
@@ -25,3 +25,3 @@ // Copyright 2017-2022 @polkadot/util authors & contributors | ||
*/ | ||
export const stringLowerFirst = converter(CC_TO_LO); | ||
export const stringLowerFirst = /*#__PURE__*/converter(CC_TO_LO); | ||
@@ -42,2 +42,2 @@ /** | ||
*/ | ||
export const stringUpperFirst = converter(CC_TO_UP); | ||
export const stringUpperFirst = /*#__PURE__*/converter(CC_TO_UP); |
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
530610
15274
+ Added@polkadot/x-bigint@10.2.1(transitive)
+ Added@polkadot/x-global@10.2.1(transitive)
+ Added@polkadot/x-textdecoder@10.2.1(transitive)
+ Added@polkadot/x-textencoder@10.2.1(transitive)
- Removed@polkadot/x-bigint@10.1.14(transitive)
- Removed@polkadot/x-global@10.1.14(transitive)
- Removed@polkadot/x-textdecoder@10.1.14(transitive)
- Removed@polkadot/x-textencoder@10.1.14(transitive)
Updated@babel/runtime@^7.20.6
Updated@polkadot/x-bigint@10.2.1
Updated@polkadot/x-global@10.2.1