Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@polkadot/util

Package Overview
Dependencies
Maintainers
2
Versions
1411
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@polkadot/util - npm Package Compare versions

Comparing version 9.4.2-9 to 9.4.2-10

2

cjs/compact/fromU8a.js

@@ -107,3 +107,3 @@ "use strict";

return [7, u8a[1] + u8a[2] * 0x100 + u8a[3] * 0x10000 + u8a[4] * 0x1000000 + u8a[5] * 0x100000000 + u8a[6] * 0x10000000000];
// for anything else, use the non-unrolled version
// for anything else, we are above the actual MAX_SAFE_INTEGER - bail out

@@ -110,0 +110,0 @@ default:

@@ -19,6 +19,3 @@ "use strict";

};
/**
* @name addTime
* @summary Add together two Time arrays
*/
/** @internal */

@@ -34,3 +31,5 @@ function add(a, b) {

}
/** @internal */
function extractSecs(ms) {

@@ -37,0 +36,0 @@ const s = ms / 1000;

@@ -12,15 +12,29 @@ "use strict";

// SPDX-License-Identifier: Apache-2.0
/** true if the environment has proper BigInt support */
const hasBigInt = typeof _xBigint.BigInt === 'function' && typeof _xBigint.BigInt.asIntN === 'function';
/** true if the environment has support for Buffer */
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';
/** true if the environment has __dirname available */
exports.hasCjs = hasCjs;
const hasDirname = typeof __dirname !== 'undefined';
/** true if the environment is ESM */
exports.hasDirname = hasDirname;
const hasEsm = !hasCjs;
/** true if the environment has process available (typically Node.js) */
exports.hasEsm = hasEsm;
const hasProcess = typeof process === 'object';
/** true if the environment has WebAssembly available */
exports.hasProcess = hasProcess;
const hasWasm = typeof WebAssembly !== 'undefined';
exports.hasWasm = hasWasm;

@@ -13,2 +13,8 @@ "use strict";

// SPDX-License-Identifier: Apache-2.0
/**
* @name lazyMethod
* @description
* Creates a lazy, on-demand getter for the specific value. Upon get the value will be evaluated.
*/
function lazyMethod(result, item, creator, getName) {

@@ -49,3 +55,9 @@ const name = getName ? getName(item) : item.toString();

}
/**
* @name lazyMethods
* @description
* Creates lazy, on-demand getters for the specific values.
*/
function lazyMethods(result, items, creator, getName) {

@@ -52,0 +64,0 @@ for (let i = 0; i < items.length; i++) {

@@ -14,4 +14,4 @@ "use strict";

type: 'cjs',
version: '9.4.2-9'
version: '9.4.2-10'
};
exports.packageInfo = packageInfo;

@@ -18,2 +18,3 @@ "use strict";

const U16_MAX = (0, _xBigint.BigInt)(256 * 256);
/** @internal */

@@ -37,3 +38,5 @@ function xor(input) {

}
/** @internal */
function toBigInt(input) {

@@ -40,0 +43,0 @@ const dvI = new DataView(input.buffer, input.byteOffset);

@@ -20,5 +20,11 @@ "use strict";

// Originally from https://github.com/polkadot-js/extension/pull/743
/** @internal */
const U8A_WRAP_ETHEREUM = (0, _toU8a.u8aToU8a)('\x19Ethereum Signed Message:\n');
/** @internal */
exports.U8A_WRAP_ETHEREUM = U8A_WRAP_ETHEREUM;
const U8A_WRAP_PREFIX = (0, _toU8a.u8aToU8a)('<Bytes>');
/** @internal */
exports.U8A_WRAP_PREFIX = U8A_WRAP_PREFIX;

@@ -28,2 +34,3 @@ const U8A_WRAP_POSTFIX = (0, _toU8a.u8aToU8a)('</Bytes>');

const WRAP_LEN = U8A_WRAP_PREFIX.length + U8A_WRAP_POSTFIX.length;
/** @internal */

@@ -33,3 +40,8 @@ function u8aIsWrapped(u8a, withEthereum) {

}
/**
* @name u8aUnwrapBytes
* @description Removes all <Bytes>...</Bytes> wrappers from the supplied value
*/
function u8aUnwrapBytes(bytes) {

@@ -40,3 +52,8 @@ const u8a = (0, _toU8a.u8aToU8a)(bytes); // we don't want to unwrap Ethereum-style wraps

}
/**
* @name u8aWrapBytes
* @description Adds a <Bytes>...</Bytes> wrapper to the supplied value (if not already existing)
*/
function u8aWrapBytes(bytes) {

@@ -43,0 +60,0 @@ const u8a = (0, _toU8a.u8aToU8a)(bytes); // if Ethereum-wrapping, we don't add our wrapping bytes

@@ -96,3 +96,3 @@ // Copyright 2017-2022 @polkadot/util authors & contributors

return [7, u8a[1] + u8a[2] * 0x100 + u8a[3] * 0x10000 + u8a[4] * 0x1000000 + u8a[5] * 0x100000000 + u8a[6] * 0x10000000000];
// for anything else, use the non-unrolled version
// for anything else, we are above the actual MAX_SAFE_INTEGER - bail out

@@ -99,0 +99,0 @@ default:

@@ -13,6 +13,3 @@ // Copyright 2017-2022 @polkadot/util authors & contributors

};
/**
* @name addTime
* @summary Add together two Time arrays
*/
/** @internal */

@@ -28,3 +25,5 @@ function add(a, b) {

}
/** @internal */
function extractSecs(ms) {

@@ -31,0 +30,0 @@ const s = ms / 1000;

@@ -0,7 +1,14 @@

/** 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 */
export declare const hasCjs: boolean;
/** true if the environment has __dirname available */
export declare const hasDirname: boolean;
/** true if the environment is ESM */
export declare const hasEsm: 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;
// Copyright 2017-2022 @polkadot/util authors & contributors
// SPDX-License-Identifier: Apache-2.0
import { BigInt } from '@polkadot/x-bigint';
/** true if the environment has proper BigInt support */
export const hasBigInt = typeof BigInt === 'function' && typeof BigInt.asIntN === 'function';
/** true if the environment has support for Buffer */
export const hasBuffer = typeof Buffer !== 'undefined';
/** 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 process available (typically Node.js) */
export const hasProcess = typeof process === 'object';
/** true if the environment has WebAssembly available */
export const hasWasm = typeof WebAssembly !== 'undefined';
declare type AnyFn = (...args: unknown[]) => unknown;
/**
* @name lazyMethod
* @description
* Creates a lazy, on-demand getter for the specific value. Upon get the value will be evaluated.
*/
export declare function lazyMethod<T, K>(result: Record<string, T> | AnyFn, item: K, creator: (d: K) => T, getName?: (d: K) => string): void;
/**
* @name lazyMethods
* @description
* Creates lazy, on-demand getters for the specific values.
*/
export declare function lazyMethods<T, K>(result: Record<string, T>, items: K[], creator: (v: K) => T, getName?: (m: K) => string): Record<string, T>;
export {};
// Copyright 2017-2022 @polkadot/types authors & contributors
// SPDX-License-Identifier: Apache-2.0
import { isUndefined } from "./is/undefined.js";
/**
* @name lazyMethod
* @description
* Creates a lazy, on-demand getter for the specific value. Upon get the value will be evaluated.
*/
export function lazyMethod(result, item, creator, getName) {

@@ -39,2 +45,8 @@ const name = getName ? getName(item) : item.toString();

}
/**
* @name lazyMethods
* @description
* Creates lazy, on-demand getters for the specific values.
*/
export function lazyMethods(result, items, creator, getName) {

@@ -41,0 +53,0 @@ for (let i = 0; i < items.length; i++) {

@@ -23,3 +23,3 @@ {

"type": "module",
"version": "9.4.2-9",
"version": "9.4.2-10",
"main": "./cjs/index.js",

@@ -703,6 +703,6 @@ "module": "./index.js",

"@babel/runtime": "^7.18.3",
"@polkadot/x-bigint": "9.4.2-9",
"@polkadot/x-global": "9.4.2-9",
"@polkadot/x-textdecoder": "9.4.2-9",
"@polkadot/x-textencoder": "9.4.2-9",
"@polkadot/x-bigint": "9.4.2-10",
"@polkadot/x-global": "9.4.2-10",
"@polkadot/x-textdecoder": "9.4.2-10",
"@polkadot/x-textencoder": "9.4.2-10",
"@types/bn.js": "^5.1.0",

@@ -709,0 +709,0 @@ "bn.js": "^5.2.1",

@@ -8,3 +8,3 @@ // Copyright 2017-2022 @polkadot/util authors & contributors

type: 'esm',
version: '9.4.2-9'
version: '9.4.2-10'
};

@@ -8,2 +8,3 @@ // Copyright 2017-2022 @polkadot/util authors & contributors

const U16_MAX = BigInt(256 * 256);
/** @internal */

@@ -27,3 +28,5 @@ function xor(input) {

}
/** @internal */
function toBigInt(input) {

@@ -30,0 +33,0 @@ const dvI = new DataView(input.buffer, input.byteOffset);

import type { U8aLike } from '../types';
/** @internal */
export declare const U8A_WRAP_ETHEREUM: Uint8Array;
/** @internal */
export declare const U8A_WRAP_PREFIX: Uint8Array;
/** @internal */
export declare const U8A_WRAP_POSTFIX: Uint8Array;
/** @internal */
export declare function u8aIsWrapped(u8a: Uint8Array, withEthereum: boolean): boolean;
/**
* @name u8aUnwrapBytes
* @description Removes all <Bytes>...</Bytes> wrappers from the supplied value
*/
export declare function u8aUnwrapBytes(bytes: U8aLike): Uint8Array;
/**
* @name u8aWrapBytes
* @description Adds a <Bytes>...</Bytes> wrapper to the supplied value (if not already existing)
*/
export declare function u8aWrapBytes(bytes: U8aLike): Uint8Array;

@@ -7,9 +7,22 @@ // Copyright 2017-2022 @polkadot/util authors & contributors

import { u8aToU8a } from "./toU8a.js";
/** @internal */
export const U8A_WRAP_ETHEREUM = u8aToU8a('\x19Ethereum Signed Message:\n');
/** @internal */
export const U8A_WRAP_PREFIX = u8aToU8a('<Bytes>');
/** @internal */
export const U8A_WRAP_POSTFIX = u8aToU8a('</Bytes>');
const WRAP_LEN = U8A_WRAP_PREFIX.length + U8A_WRAP_POSTFIX.length;
/** @internal */
export function u8aIsWrapped(u8a, withEthereum) {
return u8a.length >= WRAP_LEN && u8aEq(u8a.subarray(0, U8A_WRAP_PREFIX.length), U8A_WRAP_PREFIX) && u8aEq(u8a.slice(-U8A_WRAP_POSTFIX.length), U8A_WRAP_POSTFIX) || withEthereum && u8a.length >= U8A_WRAP_ETHEREUM.length && u8aEq(u8a.subarray(0, U8A_WRAP_ETHEREUM.length), U8A_WRAP_ETHEREUM);
}
/**
* @name u8aUnwrapBytes
* @description Removes all <Bytes>...</Bytes> wrappers from the supplied value
*/
export function u8aUnwrapBytes(bytes) {

@@ -20,2 +33,7 @@ const u8a = u8aToU8a(bytes); // we don't want to unwrap Ethereum-style wraps

}
/**
* @name u8aWrapBytes
* @description Adds a <Bytes>...</Bytes> wrapper to the supplied value (if not already existing)
*/
export function u8aWrapBytes(bytes) {

@@ -22,0 +40,0 @@ const u8a = u8aToU8a(bytes); // if Ethereum-wrapping, we don't add our wrapping bytes

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc