@btc-vision/transaction 1.7.5 → 1.7.7

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.
@@ -1,16 +0,0 @@
1
- export declare class Map<K, V> {
2
- protected _keys: K[];
3
- protected _values: Record<string, V>;
4
- get size(): number;
5
- keys(): IterableIterator<K>;
6
- values(): IterableIterator<V>;
7
- entries(): IterableIterator<[K, V]>;
8
- set(key: K, value: V): void;
9
- indexOf(key: K): number;
10
- get(key: K): V | undefined;
11
- has(key: K): boolean;
12
- delete(key: K): boolean;
13
- clear(): void;
14
- [Symbol.iterator](): IterableIterator<[K, V]>;
15
- private keyToString;
16
- }
@@ -1,16 +0,0 @@
1
- export declare class Map<K, V> {
2
- protected _keys: K[];
3
- protected _values: Record<string, V>;
4
- get size(): number;
5
- keys(): IterableIterator<K>;
6
- values(): IterableIterator<V>;
7
- entries(): IterableIterator<[K, V]>;
8
- set(key: K, value: V): void;
9
- indexOf(key: K): number;
10
- get(key: K): V | undefined;
11
- has(key: K): boolean;
12
- delete(key: K): boolean;
13
- clear(): void;
14
- [Symbol.iterator](): IterableIterator<[K, V]>;
15
- private keyToString;
16
- }
@@ -1,74 +0,0 @@
1
- export class Map {
2
- constructor() {
3
- this._keys = [];
4
- this._values = {};
5
- }
6
- get size() {
7
- return this._keys.length;
8
- }
9
- *keys() {
10
- yield* this._keys;
11
- }
12
- *values() {
13
- for (const key of this._keys) {
14
- yield this._values[this.keyToString(key)];
15
- }
16
- }
17
- *entries() {
18
- for (const key of this._keys) {
19
- yield [key, this._values[this.keyToString(key)]];
20
- }
21
- }
22
- set(key, value) {
23
- const keyStr = this.keyToString(key);
24
- if (!this.has(key)) {
25
- this._keys.push(key);
26
- }
27
- this._values[keyStr] = value;
28
- }
29
- indexOf(key) {
30
- for (let i = 0; i < this._keys.length; i++) {
31
- if (this._keys[i] === key) {
32
- return i;
33
- }
34
- }
35
- return -1;
36
- }
37
- get(key) {
38
- return this._values[this.keyToString(key)];
39
- }
40
- has(key) {
41
- return Object.prototype.hasOwnProperty.call(this._values, this.keyToString(key));
42
- }
43
- delete(key) {
44
- const index = this.indexOf(key);
45
- if (index === -1) {
46
- return false;
47
- }
48
- const keyStr = this.keyToString(key);
49
- this._keys.splice(index, 1);
50
- delete this._values[keyStr];
51
- return true;
52
- }
53
- clear() {
54
- this._keys = [];
55
- this._values = {};
56
- }
57
- *[Symbol.iterator]() {
58
- for (const key of this._keys) {
59
- yield [key, this._values[this.keyToString(key)]];
60
- }
61
- }
62
- keyToString(key) {
63
- if (typeof key === 'string') {
64
- return key;
65
- }
66
- if (typeof key === 'number' || typeof key === 'boolean') {
67
- return String(key);
68
- }
69
- if (typeof key === 'object' && key !== null) {
70
- return JSON.stringify(key);
71
- }
72
- return String(key);
73
- }
74
- }
@@ -1,87 +0,0 @@
1
- export class Map<K, V> {
2
- protected _keys: K[] = [];
3
- protected _values: Record<string, V> = {};
4
-
5
- public get size(): number {
6
- return this._keys.length;
7
- }
8
-
9
- public *keys(): IterableIterator<K> {
10
- yield* this._keys;
11
- }
12
-
13
- public *values(): IterableIterator<V> {
14
- for (const key of this._keys) {
15
- yield this._values[this.keyToString(key)];
16
- }
17
- }
18
-
19
- public *entries(): IterableIterator<[K, V]> {
20
- for (const key of this._keys) {
21
- yield [key, this._values[this.keyToString(key)]];
22
- }
23
- }
24
-
25
- public set(key: K, value: V): void {
26
- const keyStr = this.keyToString(key);
27
- if (!this.has(key)) {
28
- this._keys.push(key);
29
- }
30
-
31
- this._values[keyStr] = value;
32
- }
33
-
34
- public indexOf(key: K): number {
35
- for (let i = 0; i < this._keys.length; i++) {
36
- if (this._keys[i] === key) {
37
- return i;
38
- }
39
- }
40
- return -1;
41
- }
42
-
43
- public get(key: K): V | undefined {
44
- return this._values[this.keyToString(key)];
45
- }
46
-
47
- public has(key: K): boolean {
48
- return Object.prototype.hasOwnProperty.call(this._values, this.keyToString(key));
49
- }
50
-
51
- public delete(key: K): boolean {
52
- const index = this.indexOf(key);
53
- if (index === -1) {
54
- return false;
55
- }
56
-
57
- const keyStr = this.keyToString(key);
58
- this._keys.splice(index, 1);
59
- // eslint-disable-next-line @typescript-eslint/no-dynamic-delete
60
- delete this._values[keyStr];
61
- return true;
62
- }
63
-
64
- public clear(): void {
65
- this._keys = [];
66
- this._values = {};
67
- }
68
-
69
- *[Symbol.iterator](): IterableIterator<[K, V]> {
70
- for (const key of this._keys) {
71
- yield [key, this._values[this.keyToString(key)]];
72
- }
73
- }
74
-
75
- private keyToString(key: K): string {
76
- if (typeof key === 'string') {
77
- return key;
78
- }
79
- if (typeof key === 'number' || typeof key === 'boolean') {
80
- return String(key);
81
- }
82
- if (typeof key === 'object' && key !== null) {
83
- return JSON.stringify(key);
84
- }
85
- return String(key);
86
- }
87
- }