@polkadot/util
Advanced tools
Comparing version 12.1.1 to 12.1.2
@@ -7,4 +7,4 @@ "use strict"; | ||
* @name isClass | ||
* Tests if the supplied agrument is a Class | ||
* Tests if the supplied argument is a Class | ||
*/ | ||
exports.isClass = (0, helpers_js_1.isOnFunction)('isPrototypeOf', 'hasOwnProperty'); |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.packageInfo = void 0; | ||
exports.packageInfo = { name: '@polkadot/util', path: typeof __dirname === 'string' ? __dirname : 'auto', type: 'cjs', version: '12.1.1' }; | ||
exports.packageInfo = { name: '@polkadot/util', path: typeof __dirname === 'string' ? __dirname : 'auto', type: 'cjs', version: '12.1.2' }; |
@@ -20,3 +20,4 @@ "use strict"; | ||
const dvI = new DataView(u8a.buffer, u8a.byteOffset); | ||
const mod = u8a.length % 2; | ||
const count = u8a.length; | ||
const mod = count % 2; | ||
let result = (0, x_bigint_1.BigInt)(0); | ||
@@ -26,15 +27,15 @@ // This is mostly written for readability (with the single isNegative shortcut), | ||
if (isNegative) { | ||
for (let i = u8a.length - 2; i >= mod; i -= 2) { | ||
for (let i = count - 2; i >= mod; i -= 2) { | ||
result = (result * U16_MAX) + (0, x_bigint_1.BigInt)(dvI.getUint16(i, true) ^ 0xffff); | ||
} | ||
if (mod) { | ||
result = (result * U8_MAX) + (0, x_bigint_1.BigInt)(dvI.getUint8(0) ^ 0xff); | ||
result = (result * U8_MAX) + (0, x_bigint_1.BigInt)(u8a[0] ^ 0xff); | ||
} | ||
} | ||
else { | ||
for (let i = u8a.length - 2; i >= mod; i -= 2) { | ||
for (let i = count - 2; i >= mod; i -= 2) { | ||
result = (result * U16_MAX) + (0, x_bigint_1.BigInt)(dvI.getUint16(i, true)); | ||
} | ||
if (mod) { | ||
result = (result * U8_MAX) + (0, x_bigint_1.BigInt)(dvI.getUint8(0)); | ||
result = (result * U8_MAX) + (0, x_bigint_1.BigInt)(u8a[0]); | ||
} | ||
@@ -41,0 +42,0 @@ } |
@@ -17,2 +17,2 @@ import type { Constructor } from '../types.js'; | ||
*/ | ||
export declare function isChildClass<P extends Constructor>(Parent: P, Child?: Constructor | null | unknown): Child is P; | ||
export declare function isChildClass<P extends Constructor>(Parent: P, Child?: unknown): Child is P; |
import type { Constructor } from '../types.js'; | ||
/** | ||
* @name isClass | ||
* Tests if the supplied agrument is a Class | ||
* Tests if the supplied argument is a Class | ||
*/ | ||
export declare const isClass: <T extends Constructor>(value?: unknown) => value is T; |
import { isOnFunction } from './helpers.js'; | ||
/** | ||
* @name isClass | ||
* Tests if the supplied agrument is a Class | ||
* Tests if the supplied argument is a Class | ||
*/ | ||
export const isClass = /*#__PURE__*/ isOnFunction('isPrototypeOf', 'hasOwnProperty'); |
@@ -21,3 +21,3 @@ { | ||
"type": "module", | ||
"version": "12.1.1", | ||
"version": "12.1.2", | ||
"main": "./cjs/index.js", | ||
@@ -738,6 +738,6 @@ "module": "./index.js", | ||
"dependencies": { | ||
"@polkadot/x-bigint": "12.1.1", | ||
"@polkadot/x-global": "12.1.1", | ||
"@polkadot/x-textdecoder": "12.1.1", | ||
"@polkadot/x-textencoder": "12.1.1", | ||
"@polkadot/x-bigint": "12.1.2", | ||
"@polkadot/x-global": "12.1.2", | ||
"@polkadot/x-textdecoder": "12.1.2", | ||
"@polkadot/x-textencoder": "12.1.2", | ||
"@types/bn.js": "^5.1.1", | ||
@@ -744,0 +744,0 @@ "bn.js": "^5.2.1", |
@@ -1,1 +0,1 @@ | ||
export const packageInfo = { name: '@polkadot/util', path: (import.meta && import.meta.url) ? new URL(import.meta.url).pathname.substring(0, new URL(import.meta.url).pathname.lastIndexOf('/') + 1) : 'auto', type: 'esm', version: '12.1.1' }; | ||
export const packageInfo = { name: '@polkadot/util', path: (import.meta && import.meta.url) ? new URL(import.meta.url).pathname.substring(0, new URL(import.meta.url).pathname.lastIndexOf('/') + 1) : 'auto', type: 'esm', version: '12.1.2' }; |
@@ -5,3 +5,3 @@ /// <reference types="bn.js" /> | ||
prototype: T; | ||
new (...args: never[]): T; | ||
new (...args: any[]): T; | ||
hasOwnProperty(prop: string): boolean; | ||
@@ -8,0 +8,0 @@ isPrototypeOf(other: unknown): boolean; |
@@ -17,3 +17,4 @@ import { BigInt } from '@polkadot/x-bigint'; | ||
const dvI = new DataView(u8a.buffer, u8a.byteOffset); | ||
const mod = u8a.length % 2; | ||
const count = u8a.length; | ||
const mod = count % 2; | ||
let result = BigInt(0); | ||
@@ -23,15 +24,15 @@ // This is mostly written for readability (with the single isNegative shortcut), | ||
if (isNegative) { | ||
for (let i = u8a.length - 2; i >= mod; i -= 2) { | ||
for (let i = count - 2; i >= mod; i -= 2) { | ||
result = (result * U16_MAX) + BigInt(dvI.getUint16(i, true) ^ 0xffff); | ||
} | ||
if (mod) { | ||
result = (result * U8_MAX) + BigInt(dvI.getUint8(0) ^ 0xff); | ||
result = (result * U8_MAX) + BigInt(u8a[0] ^ 0xff); | ||
} | ||
} | ||
else { | ||
for (let i = u8a.length - 2; i >= mod; i -= 2) { | ||
for (let i = count - 2; i >= mod; i -= 2) { | ||
result = (result * U16_MAX) + BigInt(dvI.getUint16(i, true)); | ||
} | ||
if (mod) { | ||
result = (result * U8_MAX) + BigInt(dvI.getUint8(0)); | ||
result = (result * U8_MAX) + BigInt(u8a[0]); | ||
} | ||
@@ -38,0 +39,0 @@ } |
Sorry, the diff of this file is too big to display
14432
536630
+ Added@polkadot/x-bigint@12.1.2(transitive)
+ Added@polkadot/x-global@12.1.2(transitive)
+ Added@polkadot/x-textdecoder@12.1.2(transitive)
+ Added@polkadot/x-textencoder@12.1.2(transitive)
- Removed@polkadot/x-bigint@12.1.1(transitive)
- Removed@polkadot/x-global@12.1.1(transitive)
- Removed@polkadot/x-textdecoder@12.1.1(transitive)
- Removed@polkadot/x-textencoder@12.1.1(transitive)
Updated@polkadot/x-bigint@12.1.2
Updated@polkadot/x-global@12.1.2