@polkadot/types-codec 10.2.1 → 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.
@@ -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
  */
@@ -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.2.1' };
4
+ exports.packageInfo = { name: '@polkadot/types-codec', path: typeof __dirname === 'string' ? __dirname : 'auto', type: 'cjs', version: '10.3.1' };
@@ -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
  */
@@ -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
@@ -18,7 +18,7 @@
18
18
  "./cjs/detectPackage.js"
19
19
  ],
20
20
  "type": "module",
21
- "version": "10.2.1",
21
+ "version": "10.3.1",
22
22
  "main": "./cjs/index.js",
23
23
  "module": "./index.js",
24
24
  "types": "./index.d.ts",
@@ -440,8 +440,8 @@
440
440
  }
441
441
  },
442
442
  "dependencies": {
443
- "@polkadot/util": "^11.1.2",
444
- "@polkadot/x-bigint": "^11.1.2",
443
+ "@polkadot/util": "^11.1.3",
444
+ "@polkadot/x-bigint": "^11.1.3",
445
445
  "tslib": "^2.5.0"
446
446
  }
447
447
  }
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.2.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.3.1' };
@@ -1,4 +1,4 @@
1
- import { AnyString } from '../types/index.js';
1
+ import type { AnyString } from '../types/index.js';
2
2
  type Mapper = (value: string) => string;
3
3
  export declare function trim(): Mapper;
4
4
  export declare function findClosing(value: string, start: number): number;