@polkadot/types-codec 10.2.2 → 10.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cjs/extended/BitVec.js +26 -0
- package/cjs/packageInfo.js +1 -1
- package/extended/BitVec.d.ts +4 -0
- package/extended/BitVec.js +26 -0
- package/package.json +1 -1
- package/packageInfo.js +1 -1
- package/utils/sanitize.d.ts +1 -1
package/cjs/extended/BitVec.js
CHANGED
|
@@ -58,6 +58,32 @@ class BitVec extends Raw_js_1.Raw {
|
|
|
58
58
|
outer: [(0, util_1.compactToU8a)(tslib_1.__classPrivateFieldGet(this, _BitVec_decodedLength, "f")), super.toU8a()]
|
|
59
59
|
};
|
|
60
60
|
}
|
|
61
|
+
/**
|
|
62
|
+
* @description Creates a boolean array of the bit values
|
|
63
|
+
*/
|
|
64
|
+
toBoolArray() {
|
|
65
|
+
const map = [...this.toU8a(true)].map((v) => [
|
|
66
|
+
!!(v & 128),
|
|
67
|
+
!!(v & 64),
|
|
68
|
+
!!(v & 32),
|
|
69
|
+
!!(v & 16),
|
|
70
|
+
!!(v & 8),
|
|
71
|
+
!!(v & 4),
|
|
72
|
+
!!(v & 2),
|
|
73
|
+
!!(v & 1)
|
|
74
|
+
]);
|
|
75
|
+
const result = new Array(8 * map.length);
|
|
76
|
+
for (let i = 0; i < map.length; i++) {
|
|
77
|
+
const off = i * 8;
|
|
78
|
+
const v = map[i];
|
|
79
|
+
for (let j = 0; j < 8; j++) {
|
|
80
|
+
result[off + j] = tslib_1.__classPrivateFieldGet(this, _BitVec_isMsb, "f")
|
|
81
|
+
? v[j]
|
|
82
|
+
: v[7 - j];
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
return result;
|
|
86
|
+
}
|
|
61
87
|
/**
|
|
62
88
|
* @description Converts the Object to to a human-friendly JSON, with additional fields, expansion and formatting of information
|
|
63
89
|
*/
|
package/cjs/packageInfo.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.packageInfo = void 0;
|
|
4
|
-
exports.packageInfo = { name: '@polkadot/types-codec', path: typeof __dirname === 'string' ? __dirname : 'auto', type: 'cjs', version: '10.
|
|
4
|
+
exports.packageInfo = { name: '@polkadot/types-codec', path: typeof __dirname === 'string' ? __dirname : 'auto', type: 'cjs', version: '10.3.1' };
|
package/extended/BitVec.d.ts
CHANGED
|
@@ -17,6 +17,10 @@ export declare class BitVec extends Raw {
|
|
|
17
17
|
* @description Returns a breakdown of the hex encoding for this Codec
|
|
18
18
|
*/
|
|
19
19
|
inspect(): Inspect;
|
|
20
|
+
/**
|
|
21
|
+
* @description Creates a boolean array of the bit values
|
|
22
|
+
*/
|
|
23
|
+
toBoolArray(): boolean[];
|
|
20
24
|
/**
|
|
21
25
|
* @description Converts the Object to to a human-friendly JSON, with additional fields, expansion and formatting of information
|
|
22
26
|
*/
|
package/extended/BitVec.js
CHANGED
|
@@ -55,6 +55,32 @@ export class BitVec extends Raw {
|
|
|
55
55
|
outer: [compactToU8a(__classPrivateFieldGet(this, _BitVec_decodedLength, "f")), super.toU8a()]
|
|
56
56
|
};
|
|
57
57
|
}
|
|
58
|
+
/**
|
|
59
|
+
* @description Creates a boolean array of the bit values
|
|
60
|
+
*/
|
|
61
|
+
toBoolArray() {
|
|
62
|
+
const map = [...this.toU8a(true)].map((v) => [
|
|
63
|
+
!!(v & 128),
|
|
64
|
+
!!(v & 64),
|
|
65
|
+
!!(v & 32),
|
|
66
|
+
!!(v & 16),
|
|
67
|
+
!!(v & 8),
|
|
68
|
+
!!(v & 4),
|
|
69
|
+
!!(v & 2),
|
|
70
|
+
!!(v & 1)
|
|
71
|
+
]);
|
|
72
|
+
const result = new Array(8 * map.length);
|
|
73
|
+
for (let i = 0; i < map.length; i++) {
|
|
74
|
+
const off = i * 8;
|
|
75
|
+
const v = map[i];
|
|
76
|
+
for (let j = 0; j < 8; j++) {
|
|
77
|
+
result[off + j] = __classPrivateFieldGet(this, _BitVec_isMsb, "f")
|
|
78
|
+
? v[j]
|
|
79
|
+
: v[7 - j];
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
return result;
|
|
83
|
+
}
|
|
58
84
|
/**
|
|
59
85
|
* @description Converts the Object to to a human-friendly JSON, with additional fields, expansion and formatting of information
|
|
60
86
|
*/
|
package/package.json
CHANGED
package/packageInfo.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const packageInfo = { name: '@polkadot/types-codec', 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: '10.
|
|
1
|
+
export const packageInfo = { name: '@polkadot/types-codec', 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: '10.3.1' };
|
package/utils/sanitize.d.ts
CHANGED