@icazemier/gibbons 5.0.3 → 5.0.4
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/build/cjs/gibbon-processor.d.ts +19 -19
- package/build/cjs/gibbon-processor.js +20 -20
- package/build/cjs/gibbon.d.ts +11 -10
- package/build/cjs/gibbon.js +32 -13
- package/build/esm/gibbon-processor.d.ts +19 -19
- package/build/esm/gibbon-processor.js +20 -20
- package/build/esm/gibbon.d.ts +11 -10
- package/build/esm/gibbon.js +32 -13
- package/package.json +7 -6
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Just a class to carry byte position and bit position around
|
|
3
3
|
*
|
|
4
|
-
* @param {
|
|
5
|
-
* @param {
|
|
4
|
+
* @param {number} byteNo - unsigned integer value (0..n)
|
|
5
|
+
* @param {number} bitPos - unsigned integer value (0..n)
|
|
6
6
|
*/
|
|
7
7
|
export declare class BitByte {
|
|
8
8
|
byteNo: number;
|
|
@@ -22,7 +22,7 @@ export declare class GibbonProcessor {
|
|
|
22
22
|
*
|
|
23
23
|
* getByteNoAndBitPos(256); // returns { byteNo: 31, bitPos: 7}
|
|
24
24
|
* ```
|
|
25
|
-
* @param {
|
|
25
|
+
* @param {number} position - Unsigned integer value (1..n)
|
|
26
26
|
* @returns {BitByte} - A new a BitByte instance
|
|
27
27
|
* @throws {Error} when position is <= 0
|
|
28
28
|
*/
|
|
@@ -106,8 +106,8 @@ export declare class GibbonProcessor {
|
|
|
106
106
|
* // 0000 0001 === 0000 0001 (true)
|
|
107
107
|
* //
|
|
108
108
|
* ```
|
|
109
|
-
* @param {
|
|
110
|
-
* @param {
|
|
109
|
+
* @param {number} data - Unsigned integer value
|
|
110
|
+
* @param {number} index - Unsigned integer value (0..7)
|
|
111
111
|
* @returns {boolean}
|
|
112
112
|
*/
|
|
113
113
|
static isTrue(data?: number, index?: number): boolean;
|
|
@@ -126,8 +126,8 @@ export declare class GibbonProcessor {
|
|
|
126
126
|
* // 0000 0001 === 0000 0000 (false)
|
|
127
127
|
* //
|
|
128
128
|
* ```
|
|
129
|
-
* @param {
|
|
130
|
-
* @param {
|
|
129
|
+
* @param {number} data - Unsigned integer value
|
|
130
|
+
* @param {number} index - Unsigned integer value (0..7)
|
|
131
131
|
* @returns {boolean}
|
|
132
132
|
*/
|
|
133
133
|
static isFalse(data?: number, index?: number): boolean;
|
|
@@ -143,9 +143,9 @@ export declare class GibbonProcessor {
|
|
|
143
143
|
* // ---------------- OR
|
|
144
144
|
* // 0000 0001 result
|
|
145
145
|
* ```
|
|
146
|
-
* @param {
|
|
147
|
-
* @param {
|
|
148
|
-
* @returns {
|
|
146
|
+
* @param {number} data - Unsigned integer value
|
|
147
|
+
* @param {number} index - Unsigned integer value (0..7)
|
|
148
|
+
* @returns {number}
|
|
149
149
|
*/
|
|
150
150
|
static setBit(data?: number, index?: number): number;
|
|
151
151
|
/**
|
|
@@ -162,9 +162,9 @@ export declare class GibbonProcessor {
|
|
|
162
162
|
* // ---------------- AND
|
|
163
163
|
* // 0000 0000 result
|
|
164
164
|
* ```
|
|
165
|
-
* @param {
|
|
166
|
-
* @param {
|
|
167
|
-
* @returns {
|
|
165
|
+
* @param {number} data - Unsigned integer value
|
|
166
|
+
* @param {number} index - Unsigned integer value (0..7)
|
|
167
|
+
* @returns {number}
|
|
168
168
|
*/
|
|
169
169
|
static clearBit(data?: number, index?: number): number;
|
|
170
170
|
/**
|
|
@@ -189,10 +189,10 @@ export declare class GibbonProcessor {
|
|
|
189
189
|
* // ---------------- OR
|
|
190
190
|
* // 0000 0000 result
|
|
191
191
|
* ```
|
|
192
|
-
* @param {
|
|
193
|
-
* @param {
|
|
192
|
+
* @param {number} data - Unsigned integer value
|
|
193
|
+
* @param {number} index - Unsigned integer value (0..7)
|
|
194
194
|
* @param {boolean} value
|
|
195
|
-
* @returns {
|
|
195
|
+
* @returns {number}
|
|
196
196
|
*/
|
|
197
197
|
static changeBit(data: number | undefined, index: number | undefined, value: boolean): number;
|
|
198
198
|
/**
|
|
@@ -207,9 +207,9 @@ export declare class GibbonProcessor {
|
|
|
207
207
|
* // --------------- XOR
|
|
208
208
|
* // 0000 0000 result
|
|
209
209
|
* ```
|
|
210
|
-
* @param {
|
|
211
|
-
* @param {
|
|
212
|
-
* @returns {
|
|
210
|
+
* @param {number} data - Unsigned integer value
|
|
211
|
+
* @param {number} index - Unsigned integer value (0..7)
|
|
212
|
+
* @returns {number}
|
|
213
213
|
*/
|
|
214
214
|
static toggleBit(data?: number, index?: number): number;
|
|
215
215
|
}
|
|
@@ -4,8 +4,8 @@ exports.GibbonProcessor = exports.BitByte = void 0;
|
|
|
4
4
|
/**
|
|
5
5
|
* Just a class to carry byte position and bit position around
|
|
6
6
|
*
|
|
7
|
-
* @param {
|
|
8
|
-
* @param {
|
|
7
|
+
* @param {number} byteNo - unsigned integer value (0..n)
|
|
8
|
+
* @param {number} bitPos - unsigned integer value (0..n)
|
|
9
9
|
*/
|
|
10
10
|
class BitByte {
|
|
11
11
|
constructor(byteNo, bitPos) {
|
|
@@ -27,12 +27,12 @@ class GibbonProcessor {
|
|
|
27
27
|
*
|
|
28
28
|
* getByteNoAndBitPos(256); // returns { byteNo: 31, bitPos: 7}
|
|
29
29
|
* ```
|
|
30
|
-
* @param {
|
|
30
|
+
* @param {number} position - Unsigned integer value (1..n)
|
|
31
31
|
* @returns {BitByte} - A new a BitByte instance
|
|
32
32
|
* @throws {Error} when position is <= 0
|
|
33
33
|
*/
|
|
34
34
|
static getByteNoAndBitPos(position = 0) {
|
|
35
|
-
if (position <= 0) {
|
|
35
|
+
if (!Number.isInteger(position) || position <= 0) {
|
|
36
36
|
throw new Error("Illegal position");
|
|
37
37
|
}
|
|
38
38
|
const index = position - 1;
|
|
@@ -115,8 +115,8 @@ class GibbonProcessor {
|
|
|
115
115
|
* // 0000 0001 === 0000 0001 (true)
|
|
116
116
|
* //
|
|
117
117
|
* ```
|
|
118
|
-
* @param {
|
|
119
|
-
* @param {
|
|
118
|
+
* @param {number} data - Unsigned integer value
|
|
119
|
+
* @param {number} index - Unsigned integer value (0..7)
|
|
120
120
|
* @returns {boolean}
|
|
121
121
|
*/
|
|
122
122
|
static isTrue(data = 0x0, index = 0) {
|
|
@@ -138,8 +138,8 @@ class GibbonProcessor {
|
|
|
138
138
|
* // 0000 0001 === 0000 0000 (false)
|
|
139
139
|
* //
|
|
140
140
|
* ```
|
|
141
|
-
* @param {
|
|
142
|
-
* @param {
|
|
141
|
+
* @param {number} data - Unsigned integer value
|
|
142
|
+
* @param {number} index - Unsigned integer value (0..7)
|
|
143
143
|
* @returns {boolean}
|
|
144
144
|
*/
|
|
145
145
|
static isFalse(data = 0x0, index = 0) {
|
|
@@ -158,9 +158,9 @@ class GibbonProcessor {
|
|
|
158
158
|
* // ---------------- OR
|
|
159
159
|
* // 0000 0001 result
|
|
160
160
|
* ```
|
|
161
|
-
* @param {
|
|
162
|
-
* @param {
|
|
163
|
-
* @returns {
|
|
161
|
+
* @param {number} data - Unsigned integer value
|
|
162
|
+
* @param {number} index - Unsigned integer value (0..7)
|
|
163
|
+
* @returns {number}
|
|
164
164
|
*/
|
|
165
165
|
static setBit(data = 0x0, index = 0) {
|
|
166
166
|
const mask = 1 << index;
|
|
@@ -180,9 +180,9 @@ class GibbonProcessor {
|
|
|
180
180
|
* // ---------------- AND
|
|
181
181
|
* // 0000 0000 result
|
|
182
182
|
* ```
|
|
183
|
-
* @param {
|
|
184
|
-
* @param {
|
|
185
|
-
* @returns {
|
|
183
|
+
* @param {number} data - Unsigned integer value
|
|
184
|
+
* @param {number} index - Unsigned integer value (0..7)
|
|
185
|
+
* @returns {number}
|
|
186
186
|
*/
|
|
187
187
|
static clearBit(data = 0x0, index = 0) {
|
|
188
188
|
const mask = 1 << index;
|
|
@@ -210,10 +210,10 @@ class GibbonProcessor {
|
|
|
210
210
|
* // ---------------- OR
|
|
211
211
|
* // 0000 0000 result
|
|
212
212
|
* ```
|
|
213
|
-
* @param {
|
|
214
|
-
* @param {
|
|
213
|
+
* @param {number} data - Unsigned integer value
|
|
214
|
+
* @param {number} index - Unsigned integer value (0..7)
|
|
215
215
|
* @param {boolean} value
|
|
216
|
-
* @returns {
|
|
216
|
+
* @returns {number}
|
|
217
217
|
*/
|
|
218
218
|
static changeBit(data = 0x0, index = 0, value) {
|
|
219
219
|
const mask = 1 << index;
|
|
@@ -232,9 +232,9 @@ class GibbonProcessor {
|
|
|
232
232
|
* // --------------- XOR
|
|
233
233
|
* // 0000 0000 result
|
|
234
234
|
* ```
|
|
235
|
-
* @param {
|
|
236
|
-
* @param {
|
|
237
|
-
* @returns {
|
|
235
|
+
* @param {number} data - Unsigned integer value
|
|
236
|
+
* @param {number} index - Unsigned integer value (0..7)
|
|
237
|
+
* @returns {number}
|
|
238
238
|
*/
|
|
239
239
|
static toggleBit(data = 0x0, index = 0) {
|
|
240
240
|
const mask = 1 << index;
|
package/build/cjs/gibbon.d.ts
CHANGED
|
@@ -44,15 +44,16 @@ export declare class Gibbon {
|
|
|
44
44
|
* Set bit: true according to integer position in the Gibbon <br>
|
|
45
45
|
* <i>Note: Starting from 1</i>
|
|
46
46
|
* @throws {Error} Position can't exceed data view bounds.
|
|
47
|
-
* @param {
|
|
47
|
+
* @param {number} position - unsigned integer value
|
|
48
48
|
* @returns {Gibbon} - For chaining purposes
|
|
49
49
|
*/
|
|
50
50
|
setPosition(position: number): Gibbon;
|
|
51
51
|
/**
|
|
52
52
|
* Set bit: false according to integer position
|
|
53
53
|
* Note: Starting from 1
|
|
54
|
-
* @param {
|
|
54
|
+
* @param {number} position - unsigned integer value
|
|
55
55
|
* @returns {Gibbon}
|
|
56
|
+
* @throws {Error} Position can't exceed data view bounds.
|
|
56
57
|
*/
|
|
57
58
|
clearPosition(position: number): Gibbon;
|
|
58
59
|
/**
|
|
@@ -64,7 +65,7 @@ export declare class Gibbon {
|
|
|
64
65
|
*
|
|
65
66
|
* gibbon.isPosition(1); // true
|
|
66
67
|
* ```
|
|
67
|
-
* @param {
|
|
68
|
+
* @param {number} position - unsigned integer value
|
|
68
69
|
* @returns {Gibbon}
|
|
69
70
|
*/
|
|
70
71
|
togglePosition(position: number): Gibbon;
|
|
@@ -79,7 +80,7 @@ export declare class Gibbon {
|
|
|
79
80
|
* gibbon.isPosition(1); // returns true
|
|
80
81
|
* ```
|
|
81
82
|
*
|
|
82
|
-
* @param {
|
|
83
|
+
* @param {number} position - unsigned integer value
|
|
83
84
|
* @param {boolean} [on] - Optional set true or false (default : false)
|
|
84
85
|
* @returns {Gibbon} - Return itself for chaining purposes
|
|
85
86
|
*/
|
|
@@ -95,7 +96,7 @@ export declare class Gibbon {
|
|
|
95
96
|
*
|
|
96
97
|
* gibbon.isPosition(1); // returns true
|
|
97
98
|
* ```
|
|
98
|
-
* @param {
|
|
99
|
+
* @param {number} position - unsigned integer value
|
|
99
100
|
* @returns {boolean} if membership is set
|
|
100
101
|
*/
|
|
101
102
|
isPosition(position: number): boolean;
|
|
@@ -139,7 +140,7 @@ export declare class Gibbon {
|
|
|
139
140
|
* gibbon.hasAllFromPositions([-1, 2]); // true
|
|
140
141
|
* ```
|
|
141
142
|
*
|
|
142
|
-
* @param {Array<
|
|
143
|
+
* @param {Array<number>} positionArray - containing signed integer values (representing bit positions)
|
|
143
144
|
* @return {boolean} true when all positions correspondent to the given indexes
|
|
144
145
|
* @throws {TypeError} if positionArray is not an instance of array
|
|
145
146
|
*
|
|
@@ -179,7 +180,7 @@ export declare class Gibbon {
|
|
|
179
180
|
*
|
|
180
181
|
* gibbon.hasAllFromPositions([-1, 100]); // true
|
|
181
182
|
* ```
|
|
182
|
-
* @param {Array<
|
|
183
|
+
* @param {Array<number>} positionArray - containing signed integer values (representing bit positions)
|
|
183
184
|
* @return {boolean} true when one of these positions correspond
|
|
184
185
|
* @throws {TypeError} if positionArray is not an instance of array
|
|
185
186
|
*/
|
|
@@ -201,7 +202,7 @@ export declare class Gibbon {
|
|
|
201
202
|
* gibbon.setAllFromPositions([1, -2]);
|
|
202
203
|
* gibbon.hasAllFromPositions([1]); // returns true
|
|
203
204
|
* ```
|
|
204
|
-
* @param {Array<
|
|
205
|
+
* @param {Array<number>} positionArray - Array with integer values starting from 1.
|
|
205
206
|
* @returns {Gibbon} - For chaining purposes
|
|
206
207
|
* @throws {Error} When out of bounds
|
|
207
208
|
*/
|
|
@@ -225,7 +226,7 @@ export declare class Gibbon {
|
|
|
225
226
|
* gibbon.setAllFromPositions([1, -2]);
|
|
226
227
|
* gibbon.hasAllFromPositions([2]); // returns true
|
|
227
228
|
* ```
|
|
228
|
-
* @param {Array<
|
|
229
|
+
* @param {Array<number>} positionArray - Array with integer values starting from 1.
|
|
229
230
|
* @returns {Gibbon} - For chaining purposes
|
|
230
231
|
* @throws {TypeError} if positionArray is not an instance of array
|
|
231
232
|
*/
|
|
@@ -267,7 +268,7 @@ export declare class Gibbon {
|
|
|
267
268
|
static fromString(gibbonString: string): Gibbon;
|
|
268
269
|
/**
|
|
269
270
|
* Creates a new empty Gibbon from a given byte size
|
|
270
|
-
* @param {
|
|
271
|
+
* @param {number} byteSize - Allocate this Gibbon with a unsigned integer value (size in bytes)
|
|
271
272
|
* @returns {Gibbon} - new instance of a Gibbon
|
|
272
273
|
*/
|
|
273
274
|
static create(byteSize: number): Gibbon;
|
package/build/cjs/gibbon.js
CHANGED
|
@@ -87,7 +87,7 @@ class Gibbon {
|
|
|
87
87
|
* Set bit: true according to integer position in the Gibbon <br>
|
|
88
88
|
* <i>Note: Starting from 1</i>
|
|
89
89
|
* @throws {Error} Position can't exceed data view bounds.
|
|
90
|
-
* @param {
|
|
90
|
+
* @param {number} position - unsigned integer value
|
|
91
91
|
* @returns {Gibbon} - For chaining purposes
|
|
92
92
|
*/
|
|
93
93
|
setPosition(position) {
|
|
@@ -108,11 +108,15 @@ class Gibbon {
|
|
|
108
108
|
/**
|
|
109
109
|
* Set bit: false according to integer position
|
|
110
110
|
* Note: Starting from 1
|
|
111
|
-
* @param {
|
|
111
|
+
* @param {number} position - unsigned integer value
|
|
112
112
|
* @returns {Gibbon}
|
|
113
|
+
* @throws {Error} Position can't exceed data view bounds.
|
|
113
114
|
*/
|
|
114
115
|
clearPosition(position) {
|
|
115
116
|
const bitBytePosition = gibbon_processor_js_1.GibbonProcessor.getByteNoAndBitPos(position);
|
|
117
|
+
if (bitBytePosition.byteNo >= this.dataView.byteLength) {
|
|
118
|
+
throw new Error("Illegal position");
|
|
119
|
+
}
|
|
116
120
|
let byte = this.dataView.getUint8(bitBytePosition.byteNo);
|
|
117
121
|
byte = gibbon_processor_js_1.GibbonProcessor.clearBit(byte, bitBytePosition.bitPos);
|
|
118
122
|
this.dataView.setUint8(bitBytePosition.byteNo, byte);
|
|
@@ -127,11 +131,14 @@ class Gibbon {
|
|
|
127
131
|
*
|
|
128
132
|
* gibbon.isPosition(1); // true
|
|
129
133
|
* ```
|
|
130
|
-
* @param {
|
|
134
|
+
* @param {number} position - unsigned integer value
|
|
131
135
|
* @returns {Gibbon}
|
|
132
136
|
*/
|
|
133
137
|
togglePosition(position) {
|
|
134
138
|
const bitBytePosition = gibbon_processor_js_1.GibbonProcessor.getByteNoAndBitPos(position);
|
|
139
|
+
if (bitBytePosition.byteNo >= this.dataView.byteLength) {
|
|
140
|
+
throw new Error("Illegal position");
|
|
141
|
+
}
|
|
135
142
|
let byte = this.dataView.getUint8(bitBytePosition.byteNo);
|
|
136
143
|
byte = gibbon_processor_js_1.GibbonProcessor.toggleBit(byte, bitBytePosition.bitPos);
|
|
137
144
|
this.dataView.setUint8(bitBytePosition.byteNo, byte);
|
|
@@ -148,12 +155,15 @@ class Gibbon {
|
|
|
148
155
|
* gibbon.isPosition(1); // returns true
|
|
149
156
|
* ```
|
|
150
157
|
*
|
|
151
|
-
* @param {
|
|
158
|
+
* @param {number} position - unsigned integer value
|
|
152
159
|
* @param {boolean} [on] - Optional set true or false (default : false)
|
|
153
160
|
* @returns {Gibbon} - Return itself for chaining purposes
|
|
154
161
|
*/
|
|
155
162
|
changePosition(position, on = false) {
|
|
156
163
|
const bitBytePosition = gibbon_processor_js_1.GibbonProcessor.getByteNoAndBitPos(position);
|
|
164
|
+
if (bitBytePosition.byteNo >= this.dataView.byteLength) {
|
|
165
|
+
throw new Error("Illegal position");
|
|
166
|
+
}
|
|
157
167
|
let byte = this.dataView.getUint8(bitBytePosition.byteNo);
|
|
158
168
|
byte = gibbon_processor_js_1.GibbonProcessor.changeBit(byte, bitBytePosition.bitPos, on);
|
|
159
169
|
this.dataView.setUint8(bitBytePosition.byteNo, byte);
|
|
@@ -170,11 +180,14 @@ class Gibbon {
|
|
|
170
180
|
*
|
|
171
181
|
* gibbon.isPosition(1); // returns true
|
|
172
182
|
* ```
|
|
173
|
-
* @param {
|
|
183
|
+
* @param {number} position - unsigned integer value
|
|
174
184
|
* @returns {boolean} if membership is set
|
|
175
185
|
*/
|
|
176
186
|
isPosition(position) {
|
|
177
187
|
const bitBytePosition = gibbon_processor_js_1.GibbonProcessor.getByteNoAndBitPos(position);
|
|
188
|
+
if (bitBytePosition.byteNo >= this.dataView.byteLength) {
|
|
189
|
+
throw new Error("Illegal position");
|
|
190
|
+
}
|
|
178
191
|
const byte = this.dataView.getUint8(bitBytePosition.byteNo);
|
|
179
192
|
return gibbon_processor_js_1.GibbonProcessor.isTrue(byte, bitBytePosition.bitPos);
|
|
180
193
|
}
|
|
@@ -243,7 +256,7 @@ class Gibbon {
|
|
|
243
256
|
* gibbon.hasAllFromPositions([-1, 2]); // true
|
|
244
257
|
* ```
|
|
245
258
|
*
|
|
246
|
-
* @param {Array<
|
|
259
|
+
* @param {Array<number>} positionArray - containing signed integer values (representing bit positions)
|
|
247
260
|
* @return {boolean} true when all positions correspondent to the given indexes
|
|
248
261
|
* @throws {TypeError} if positionArray is not an instance of array
|
|
249
262
|
*
|
|
@@ -300,7 +313,7 @@ class Gibbon {
|
|
|
300
313
|
*
|
|
301
314
|
* gibbon.hasAllFromPositions([-1, 100]); // true
|
|
302
315
|
* ```
|
|
303
|
-
* @param {Array<
|
|
316
|
+
* @param {Array<number>} positionArray - containing signed integer values (representing bit positions)
|
|
304
317
|
* @return {boolean} true when one of these positions correspond
|
|
305
318
|
* @throws {TypeError} if positionArray is not an instance of array
|
|
306
319
|
*/
|
|
@@ -328,7 +341,7 @@ class Gibbon {
|
|
|
328
341
|
* gibbon.setAllFromPositions([1, -2]);
|
|
329
342
|
* gibbon.hasAllFromPositions([1]); // returns true
|
|
330
343
|
* ```
|
|
331
|
-
* @param {Array<
|
|
344
|
+
* @param {Array<number>} positionArray - Array with integer values starting from 1.
|
|
332
345
|
* @returns {Gibbon} - For chaining purposes
|
|
333
346
|
* @throws {Error} When out of bounds
|
|
334
347
|
*/
|
|
@@ -369,7 +382,7 @@ class Gibbon {
|
|
|
369
382
|
* gibbon.setAllFromPositions([1, -2]);
|
|
370
383
|
* gibbon.hasAllFromPositions([2]); // returns true
|
|
371
384
|
* ```
|
|
372
|
-
* @param {Array<
|
|
385
|
+
* @param {Array<number>} positionArray - Array with integer values starting from 1.
|
|
373
386
|
* @returns {Gibbon} - For chaining purposes
|
|
374
387
|
* @throws {TypeError} if positionArray is not an instance of array
|
|
375
388
|
*/
|
|
@@ -426,9 +439,12 @@ class Gibbon {
|
|
|
426
439
|
* @override
|
|
427
440
|
*/
|
|
428
441
|
toString() {
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
442
|
+
const view = new Uint16Array(this.arrayBuffer);
|
|
443
|
+
let result = "";
|
|
444
|
+
for (let i = 0; i < view.length; i++) {
|
|
445
|
+
result += String.fromCharCode(view[i]);
|
|
446
|
+
}
|
|
447
|
+
return result;
|
|
432
448
|
}
|
|
433
449
|
/**
|
|
434
450
|
* Class method to create a new Gibbon from a string<br>
|
|
@@ -447,10 +463,13 @@ class Gibbon {
|
|
|
447
463
|
}
|
|
448
464
|
/**
|
|
449
465
|
* Creates a new empty Gibbon from a given byte size
|
|
450
|
-
* @param {
|
|
466
|
+
* @param {number} byteSize - Allocate this Gibbon with a unsigned integer value (size in bytes)
|
|
451
467
|
* @returns {Gibbon} - new instance of a Gibbon
|
|
452
468
|
*/
|
|
453
469
|
static create(byteSize) {
|
|
470
|
+
if (!Number.isInteger(byteSize) || byteSize <= 0) {
|
|
471
|
+
throw new Error("byteSize must be a positive integer");
|
|
472
|
+
}
|
|
454
473
|
const arrayBuffer = new ArrayBuffer(byteSize);
|
|
455
474
|
return new Gibbon(arrayBuffer);
|
|
456
475
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Just a class to carry byte position and bit position around
|
|
3
3
|
*
|
|
4
|
-
* @param {
|
|
5
|
-
* @param {
|
|
4
|
+
* @param {number} byteNo - unsigned integer value (0..n)
|
|
5
|
+
* @param {number} bitPos - unsigned integer value (0..n)
|
|
6
6
|
*/
|
|
7
7
|
export declare class BitByte {
|
|
8
8
|
byteNo: number;
|
|
@@ -22,7 +22,7 @@ export declare class GibbonProcessor {
|
|
|
22
22
|
*
|
|
23
23
|
* getByteNoAndBitPos(256); // returns { byteNo: 31, bitPos: 7}
|
|
24
24
|
* ```
|
|
25
|
-
* @param {
|
|
25
|
+
* @param {number} position - Unsigned integer value (1..n)
|
|
26
26
|
* @returns {BitByte} - A new a BitByte instance
|
|
27
27
|
* @throws {Error} when position is <= 0
|
|
28
28
|
*/
|
|
@@ -106,8 +106,8 @@ export declare class GibbonProcessor {
|
|
|
106
106
|
* // 0000 0001 === 0000 0001 (true)
|
|
107
107
|
* //
|
|
108
108
|
* ```
|
|
109
|
-
* @param {
|
|
110
|
-
* @param {
|
|
109
|
+
* @param {number} data - Unsigned integer value
|
|
110
|
+
* @param {number} index - Unsigned integer value (0..7)
|
|
111
111
|
* @returns {boolean}
|
|
112
112
|
*/
|
|
113
113
|
static isTrue(data?: number, index?: number): boolean;
|
|
@@ -126,8 +126,8 @@ export declare class GibbonProcessor {
|
|
|
126
126
|
* // 0000 0001 === 0000 0000 (false)
|
|
127
127
|
* //
|
|
128
128
|
* ```
|
|
129
|
-
* @param {
|
|
130
|
-
* @param {
|
|
129
|
+
* @param {number} data - Unsigned integer value
|
|
130
|
+
* @param {number} index - Unsigned integer value (0..7)
|
|
131
131
|
* @returns {boolean}
|
|
132
132
|
*/
|
|
133
133
|
static isFalse(data?: number, index?: number): boolean;
|
|
@@ -143,9 +143,9 @@ export declare class GibbonProcessor {
|
|
|
143
143
|
* // ---------------- OR
|
|
144
144
|
* // 0000 0001 result
|
|
145
145
|
* ```
|
|
146
|
-
* @param {
|
|
147
|
-
* @param {
|
|
148
|
-
* @returns {
|
|
146
|
+
* @param {number} data - Unsigned integer value
|
|
147
|
+
* @param {number} index - Unsigned integer value (0..7)
|
|
148
|
+
* @returns {number}
|
|
149
149
|
*/
|
|
150
150
|
static setBit(data?: number, index?: number): number;
|
|
151
151
|
/**
|
|
@@ -162,9 +162,9 @@ export declare class GibbonProcessor {
|
|
|
162
162
|
* // ---------------- AND
|
|
163
163
|
* // 0000 0000 result
|
|
164
164
|
* ```
|
|
165
|
-
* @param {
|
|
166
|
-
* @param {
|
|
167
|
-
* @returns {
|
|
165
|
+
* @param {number} data - Unsigned integer value
|
|
166
|
+
* @param {number} index - Unsigned integer value (0..7)
|
|
167
|
+
* @returns {number}
|
|
168
168
|
*/
|
|
169
169
|
static clearBit(data?: number, index?: number): number;
|
|
170
170
|
/**
|
|
@@ -189,10 +189,10 @@ export declare class GibbonProcessor {
|
|
|
189
189
|
* // ---------------- OR
|
|
190
190
|
* // 0000 0000 result
|
|
191
191
|
* ```
|
|
192
|
-
* @param {
|
|
193
|
-
* @param {
|
|
192
|
+
* @param {number} data - Unsigned integer value
|
|
193
|
+
* @param {number} index - Unsigned integer value (0..7)
|
|
194
194
|
* @param {boolean} value
|
|
195
|
-
* @returns {
|
|
195
|
+
* @returns {number}
|
|
196
196
|
*/
|
|
197
197
|
static changeBit(data: number | undefined, index: number | undefined, value: boolean): number;
|
|
198
198
|
/**
|
|
@@ -207,9 +207,9 @@ export declare class GibbonProcessor {
|
|
|
207
207
|
* // --------------- XOR
|
|
208
208
|
* // 0000 0000 result
|
|
209
209
|
* ```
|
|
210
|
-
* @param {
|
|
211
|
-
* @param {
|
|
212
|
-
* @returns {
|
|
210
|
+
* @param {number} data - Unsigned integer value
|
|
211
|
+
* @param {number} index - Unsigned integer value (0..7)
|
|
212
|
+
* @returns {number}
|
|
213
213
|
*/
|
|
214
214
|
static toggleBit(data?: number, index?: number): number;
|
|
215
215
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Just a class to carry byte position and bit position around
|
|
3
3
|
*
|
|
4
|
-
* @param {
|
|
5
|
-
* @param {
|
|
4
|
+
* @param {number} byteNo - unsigned integer value (0..n)
|
|
5
|
+
* @param {number} bitPos - unsigned integer value (0..n)
|
|
6
6
|
*/
|
|
7
7
|
export class BitByte {
|
|
8
8
|
byteNo;
|
|
@@ -25,12 +25,12 @@ export class GibbonProcessor {
|
|
|
25
25
|
*
|
|
26
26
|
* getByteNoAndBitPos(256); // returns { byteNo: 31, bitPos: 7}
|
|
27
27
|
* ```
|
|
28
|
-
* @param {
|
|
28
|
+
* @param {number} position - Unsigned integer value (1..n)
|
|
29
29
|
* @returns {BitByte} - A new a BitByte instance
|
|
30
30
|
* @throws {Error} when position is <= 0
|
|
31
31
|
*/
|
|
32
32
|
static getByteNoAndBitPos(position = 0) {
|
|
33
|
-
if (position <= 0) {
|
|
33
|
+
if (!Number.isInteger(position) || position <= 0) {
|
|
34
34
|
throw new Error("Illegal position");
|
|
35
35
|
}
|
|
36
36
|
const index = position - 1;
|
|
@@ -113,8 +113,8 @@ export class GibbonProcessor {
|
|
|
113
113
|
* // 0000 0001 === 0000 0001 (true)
|
|
114
114
|
* //
|
|
115
115
|
* ```
|
|
116
|
-
* @param {
|
|
117
|
-
* @param {
|
|
116
|
+
* @param {number} data - Unsigned integer value
|
|
117
|
+
* @param {number} index - Unsigned integer value (0..7)
|
|
118
118
|
* @returns {boolean}
|
|
119
119
|
*/
|
|
120
120
|
static isTrue(data = 0x0, index = 0) {
|
|
@@ -136,8 +136,8 @@ export class GibbonProcessor {
|
|
|
136
136
|
* // 0000 0001 === 0000 0000 (false)
|
|
137
137
|
* //
|
|
138
138
|
* ```
|
|
139
|
-
* @param {
|
|
140
|
-
* @param {
|
|
139
|
+
* @param {number} data - Unsigned integer value
|
|
140
|
+
* @param {number} index - Unsigned integer value (0..7)
|
|
141
141
|
* @returns {boolean}
|
|
142
142
|
*/
|
|
143
143
|
static isFalse(data = 0x0, index = 0) {
|
|
@@ -156,9 +156,9 @@ export class GibbonProcessor {
|
|
|
156
156
|
* // ---------------- OR
|
|
157
157
|
* // 0000 0001 result
|
|
158
158
|
* ```
|
|
159
|
-
* @param {
|
|
160
|
-
* @param {
|
|
161
|
-
* @returns {
|
|
159
|
+
* @param {number} data - Unsigned integer value
|
|
160
|
+
* @param {number} index - Unsigned integer value (0..7)
|
|
161
|
+
* @returns {number}
|
|
162
162
|
*/
|
|
163
163
|
static setBit(data = 0x0, index = 0) {
|
|
164
164
|
const mask = 1 << index;
|
|
@@ -178,9 +178,9 @@ export class GibbonProcessor {
|
|
|
178
178
|
* // ---------------- AND
|
|
179
179
|
* // 0000 0000 result
|
|
180
180
|
* ```
|
|
181
|
-
* @param {
|
|
182
|
-
* @param {
|
|
183
|
-
* @returns {
|
|
181
|
+
* @param {number} data - Unsigned integer value
|
|
182
|
+
* @param {number} index - Unsigned integer value (0..7)
|
|
183
|
+
* @returns {number}
|
|
184
184
|
*/
|
|
185
185
|
static clearBit(data = 0x0, index = 0) {
|
|
186
186
|
const mask = 1 << index;
|
|
@@ -208,10 +208,10 @@ export class GibbonProcessor {
|
|
|
208
208
|
* // ---------------- OR
|
|
209
209
|
* // 0000 0000 result
|
|
210
210
|
* ```
|
|
211
|
-
* @param {
|
|
212
|
-
* @param {
|
|
211
|
+
* @param {number} data - Unsigned integer value
|
|
212
|
+
* @param {number} index - Unsigned integer value (0..7)
|
|
213
213
|
* @param {boolean} value
|
|
214
|
-
* @returns {
|
|
214
|
+
* @returns {number}
|
|
215
215
|
*/
|
|
216
216
|
static changeBit(data = 0x0, index = 0, value) {
|
|
217
217
|
const mask = 1 << index;
|
|
@@ -230,9 +230,9 @@ export class GibbonProcessor {
|
|
|
230
230
|
* // --------------- XOR
|
|
231
231
|
* // 0000 0000 result
|
|
232
232
|
* ```
|
|
233
|
-
* @param {
|
|
234
|
-
* @param {
|
|
235
|
-
* @returns {
|
|
233
|
+
* @param {number} data - Unsigned integer value
|
|
234
|
+
* @param {number} index - Unsigned integer value (0..7)
|
|
235
|
+
* @returns {number}
|
|
236
236
|
*/
|
|
237
237
|
static toggleBit(data = 0x0, index = 0) {
|
|
238
238
|
const mask = 1 << index;
|
package/build/esm/gibbon.d.ts
CHANGED
|
@@ -44,15 +44,16 @@ export declare class Gibbon {
|
|
|
44
44
|
* Set bit: true according to integer position in the Gibbon <br>
|
|
45
45
|
* <i>Note: Starting from 1</i>
|
|
46
46
|
* @throws {Error} Position can't exceed data view bounds.
|
|
47
|
-
* @param {
|
|
47
|
+
* @param {number} position - unsigned integer value
|
|
48
48
|
* @returns {Gibbon} - For chaining purposes
|
|
49
49
|
*/
|
|
50
50
|
setPosition(position: number): Gibbon;
|
|
51
51
|
/**
|
|
52
52
|
* Set bit: false according to integer position
|
|
53
53
|
* Note: Starting from 1
|
|
54
|
-
* @param {
|
|
54
|
+
* @param {number} position - unsigned integer value
|
|
55
55
|
* @returns {Gibbon}
|
|
56
|
+
* @throws {Error} Position can't exceed data view bounds.
|
|
56
57
|
*/
|
|
57
58
|
clearPosition(position: number): Gibbon;
|
|
58
59
|
/**
|
|
@@ -64,7 +65,7 @@ export declare class Gibbon {
|
|
|
64
65
|
*
|
|
65
66
|
* gibbon.isPosition(1); // true
|
|
66
67
|
* ```
|
|
67
|
-
* @param {
|
|
68
|
+
* @param {number} position - unsigned integer value
|
|
68
69
|
* @returns {Gibbon}
|
|
69
70
|
*/
|
|
70
71
|
togglePosition(position: number): Gibbon;
|
|
@@ -79,7 +80,7 @@ export declare class Gibbon {
|
|
|
79
80
|
* gibbon.isPosition(1); // returns true
|
|
80
81
|
* ```
|
|
81
82
|
*
|
|
82
|
-
* @param {
|
|
83
|
+
* @param {number} position - unsigned integer value
|
|
83
84
|
* @param {boolean} [on] - Optional set true or false (default : false)
|
|
84
85
|
* @returns {Gibbon} - Return itself for chaining purposes
|
|
85
86
|
*/
|
|
@@ -95,7 +96,7 @@ export declare class Gibbon {
|
|
|
95
96
|
*
|
|
96
97
|
* gibbon.isPosition(1); // returns true
|
|
97
98
|
* ```
|
|
98
|
-
* @param {
|
|
99
|
+
* @param {number} position - unsigned integer value
|
|
99
100
|
* @returns {boolean} if membership is set
|
|
100
101
|
*/
|
|
101
102
|
isPosition(position: number): boolean;
|
|
@@ -139,7 +140,7 @@ export declare class Gibbon {
|
|
|
139
140
|
* gibbon.hasAllFromPositions([-1, 2]); // true
|
|
140
141
|
* ```
|
|
141
142
|
*
|
|
142
|
-
* @param {Array<
|
|
143
|
+
* @param {Array<number>} positionArray - containing signed integer values (representing bit positions)
|
|
143
144
|
* @return {boolean} true when all positions correspondent to the given indexes
|
|
144
145
|
* @throws {TypeError} if positionArray is not an instance of array
|
|
145
146
|
*
|
|
@@ -179,7 +180,7 @@ export declare class Gibbon {
|
|
|
179
180
|
*
|
|
180
181
|
* gibbon.hasAllFromPositions([-1, 100]); // true
|
|
181
182
|
* ```
|
|
182
|
-
* @param {Array<
|
|
183
|
+
* @param {Array<number>} positionArray - containing signed integer values (representing bit positions)
|
|
183
184
|
* @return {boolean} true when one of these positions correspond
|
|
184
185
|
* @throws {TypeError} if positionArray is not an instance of array
|
|
185
186
|
*/
|
|
@@ -201,7 +202,7 @@ export declare class Gibbon {
|
|
|
201
202
|
* gibbon.setAllFromPositions([1, -2]);
|
|
202
203
|
* gibbon.hasAllFromPositions([1]); // returns true
|
|
203
204
|
* ```
|
|
204
|
-
* @param {Array<
|
|
205
|
+
* @param {Array<number>} positionArray - Array with integer values starting from 1.
|
|
205
206
|
* @returns {Gibbon} - For chaining purposes
|
|
206
207
|
* @throws {Error} When out of bounds
|
|
207
208
|
*/
|
|
@@ -225,7 +226,7 @@ export declare class Gibbon {
|
|
|
225
226
|
* gibbon.setAllFromPositions([1, -2]);
|
|
226
227
|
* gibbon.hasAllFromPositions([2]); // returns true
|
|
227
228
|
* ```
|
|
228
|
-
* @param {Array<
|
|
229
|
+
* @param {Array<number>} positionArray - Array with integer values starting from 1.
|
|
229
230
|
* @returns {Gibbon} - For chaining purposes
|
|
230
231
|
* @throws {TypeError} if positionArray is not an instance of array
|
|
231
232
|
*/
|
|
@@ -267,7 +268,7 @@ export declare class Gibbon {
|
|
|
267
268
|
static fromString(gibbonString: string): Gibbon;
|
|
268
269
|
/**
|
|
269
270
|
* Creates a new empty Gibbon from a given byte size
|
|
270
|
-
* @param {
|
|
271
|
+
* @param {number} byteSize - Allocate this Gibbon with a unsigned integer value (size in bytes)
|
|
271
272
|
* @returns {Gibbon} - new instance of a Gibbon
|
|
272
273
|
*/
|
|
273
274
|
static create(byteSize: number): Gibbon;
|
package/build/esm/gibbon.js
CHANGED
|
@@ -86,7 +86,7 @@ export class Gibbon {
|
|
|
86
86
|
* Set bit: true according to integer position in the Gibbon <br>
|
|
87
87
|
* <i>Note: Starting from 1</i>
|
|
88
88
|
* @throws {Error} Position can't exceed data view bounds.
|
|
89
|
-
* @param {
|
|
89
|
+
* @param {number} position - unsigned integer value
|
|
90
90
|
* @returns {Gibbon} - For chaining purposes
|
|
91
91
|
*/
|
|
92
92
|
setPosition(position) {
|
|
@@ -107,11 +107,15 @@ export class Gibbon {
|
|
|
107
107
|
/**
|
|
108
108
|
* Set bit: false according to integer position
|
|
109
109
|
* Note: Starting from 1
|
|
110
|
-
* @param {
|
|
110
|
+
* @param {number} position - unsigned integer value
|
|
111
111
|
* @returns {Gibbon}
|
|
112
|
+
* @throws {Error} Position can't exceed data view bounds.
|
|
112
113
|
*/
|
|
113
114
|
clearPosition(position) {
|
|
114
115
|
const bitBytePosition = GibbonProcessor.getByteNoAndBitPos(position);
|
|
116
|
+
if (bitBytePosition.byteNo >= this.dataView.byteLength) {
|
|
117
|
+
throw new Error("Illegal position");
|
|
118
|
+
}
|
|
115
119
|
let byte = this.dataView.getUint8(bitBytePosition.byteNo);
|
|
116
120
|
byte = GibbonProcessor.clearBit(byte, bitBytePosition.bitPos);
|
|
117
121
|
this.dataView.setUint8(bitBytePosition.byteNo, byte);
|
|
@@ -126,11 +130,14 @@ export class Gibbon {
|
|
|
126
130
|
*
|
|
127
131
|
* gibbon.isPosition(1); // true
|
|
128
132
|
* ```
|
|
129
|
-
* @param {
|
|
133
|
+
* @param {number} position - unsigned integer value
|
|
130
134
|
* @returns {Gibbon}
|
|
131
135
|
*/
|
|
132
136
|
togglePosition(position) {
|
|
133
137
|
const bitBytePosition = GibbonProcessor.getByteNoAndBitPos(position);
|
|
138
|
+
if (bitBytePosition.byteNo >= this.dataView.byteLength) {
|
|
139
|
+
throw new Error("Illegal position");
|
|
140
|
+
}
|
|
134
141
|
let byte = this.dataView.getUint8(bitBytePosition.byteNo);
|
|
135
142
|
byte = GibbonProcessor.toggleBit(byte, bitBytePosition.bitPos);
|
|
136
143
|
this.dataView.setUint8(bitBytePosition.byteNo, byte);
|
|
@@ -147,12 +154,15 @@ export class Gibbon {
|
|
|
147
154
|
* gibbon.isPosition(1); // returns true
|
|
148
155
|
* ```
|
|
149
156
|
*
|
|
150
|
-
* @param {
|
|
157
|
+
* @param {number} position - unsigned integer value
|
|
151
158
|
* @param {boolean} [on] - Optional set true or false (default : false)
|
|
152
159
|
* @returns {Gibbon} - Return itself for chaining purposes
|
|
153
160
|
*/
|
|
154
161
|
changePosition(position, on = false) {
|
|
155
162
|
const bitBytePosition = GibbonProcessor.getByteNoAndBitPos(position);
|
|
163
|
+
if (bitBytePosition.byteNo >= this.dataView.byteLength) {
|
|
164
|
+
throw new Error("Illegal position");
|
|
165
|
+
}
|
|
156
166
|
let byte = this.dataView.getUint8(bitBytePosition.byteNo);
|
|
157
167
|
byte = GibbonProcessor.changeBit(byte, bitBytePosition.bitPos, on);
|
|
158
168
|
this.dataView.setUint8(bitBytePosition.byteNo, byte);
|
|
@@ -169,11 +179,14 @@ export class Gibbon {
|
|
|
169
179
|
*
|
|
170
180
|
* gibbon.isPosition(1); // returns true
|
|
171
181
|
* ```
|
|
172
|
-
* @param {
|
|
182
|
+
* @param {number} position - unsigned integer value
|
|
173
183
|
* @returns {boolean} if membership is set
|
|
174
184
|
*/
|
|
175
185
|
isPosition(position) {
|
|
176
186
|
const bitBytePosition = GibbonProcessor.getByteNoAndBitPos(position);
|
|
187
|
+
if (bitBytePosition.byteNo >= this.dataView.byteLength) {
|
|
188
|
+
throw new Error("Illegal position");
|
|
189
|
+
}
|
|
177
190
|
const byte = this.dataView.getUint8(bitBytePosition.byteNo);
|
|
178
191
|
return GibbonProcessor.isTrue(byte, bitBytePosition.bitPos);
|
|
179
192
|
}
|
|
@@ -242,7 +255,7 @@ export class Gibbon {
|
|
|
242
255
|
* gibbon.hasAllFromPositions([-1, 2]); // true
|
|
243
256
|
* ```
|
|
244
257
|
*
|
|
245
|
-
* @param {Array<
|
|
258
|
+
* @param {Array<number>} positionArray - containing signed integer values (representing bit positions)
|
|
246
259
|
* @return {boolean} true when all positions correspondent to the given indexes
|
|
247
260
|
* @throws {TypeError} if positionArray is not an instance of array
|
|
248
261
|
*
|
|
@@ -299,7 +312,7 @@ export class Gibbon {
|
|
|
299
312
|
*
|
|
300
313
|
* gibbon.hasAllFromPositions([-1, 100]); // true
|
|
301
314
|
* ```
|
|
302
|
-
* @param {Array<
|
|
315
|
+
* @param {Array<number>} positionArray - containing signed integer values (representing bit positions)
|
|
303
316
|
* @return {boolean} true when one of these positions correspond
|
|
304
317
|
* @throws {TypeError} if positionArray is not an instance of array
|
|
305
318
|
*/
|
|
@@ -327,7 +340,7 @@ export class Gibbon {
|
|
|
327
340
|
* gibbon.setAllFromPositions([1, -2]);
|
|
328
341
|
* gibbon.hasAllFromPositions([1]); // returns true
|
|
329
342
|
* ```
|
|
330
|
-
* @param {Array<
|
|
343
|
+
* @param {Array<number>} positionArray - Array with integer values starting from 1.
|
|
331
344
|
* @returns {Gibbon} - For chaining purposes
|
|
332
345
|
* @throws {Error} When out of bounds
|
|
333
346
|
*/
|
|
@@ -368,7 +381,7 @@ export class Gibbon {
|
|
|
368
381
|
* gibbon.setAllFromPositions([1, -2]);
|
|
369
382
|
* gibbon.hasAllFromPositions([2]); // returns true
|
|
370
383
|
* ```
|
|
371
|
-
* @param {Array<
|
|
384
|
+
* @param {Array<number>} positionArray - Array with integer values starting from 1.
|
|
372
385
|
* @returns {Gibbon} - For chaining purposes
|
|
373
386
|
* @throws {TypeError} if positionArray is not an instance of array
|
|
374
387
|
*/
|
|
@@ -425,9 +438,12 @@ export class Gibbon {
|
|
|
425
438
|
* @override
|
|
426
439
|
*/
|
|
427
440
|
toString() {
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
441
|
+
const view = new Uint16Array(this.arrayBuffer);
|
|
442
|
+
let result = "";
|
|
443
|
+
for (let i = 0; i < view.length; i++) {
|
|
444
|
+
result += String.fromCharCode(view[i]);
|
|
445
|
+
}
|
|
446
|
+
return result;
|
|
431
447
|
}
|
|
432
448
|
/**
|
|
433
449
|
* Class method to create a new Gibbon from a string<br>
|
|
@@ -446,10 +462,13 @@ export class Gibbon {
|
|
|
446
462
|
}
|
|
447
463
|
/**
|
|
448
464
|
* Creates a new empty Gibbon from a given byte size
|
|
449
|
-
* @param {
|
|
465
|
+
* @param {number} byteSize - Allocate this Gibbon with a unsigned integer value (size in bytes)
|
|
450
466
|
* @returns {Gibbon} - new instance of a Gibbon
|
|
451
467
|
*/
|
|
452
468
|
static create(byteSize) {
|
|
469
|
+
if (!Number.isInteger(byteSize) || byteSize <= 0) {
|
|
470
|
+
throw new Error("byteSize must be a positive integer");
|
|
471
|
+
}
|
|
453
472
|
const arrayBuffer = new ArrayBuffer(byteSize);
|
|
454
473
|
return new Gibbon(arrayBuffer);
|
|
455
474
|
}
|
package/package.json
CHANGED
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
"name": "@icazemier/gibbons",
|
|
3
3
|
"type": "module",
|
|
4
4
|
"private": false,
|
|
5
|
-
"version": "5.0.
|
|
6
|
-
"description": "Gibbons is a Node.js module which helps in managing user groups and user permissions with `bitwise`
|
|
5
|
+
"version": "5.0.4",
|
|
6
|
+
"description": "Gibbons is a Node.js module which helps in managing user groups and user permissions with `bitwise` efficiency.",
|
|
7
7
|
"contributors": [
|
|
8
8
|
{
|
|
9
9
|
"name": "Ivo Cazemier",
|
|
@@ -42,7 +42,8 @@
|
|
|
42
42
|
"test": "cross-env NODE_ENV=test vitest run --coverage",
|
|
43
43
|
"build:esm": "tsc -p tsconfig-build-esm.json",
|
|
44
44
|
"build:cjs": "tsc -p tsconfig-build-cjs.json",
|
|
45
|
-
"build": "rimraf build && npm run build:esm && npm run build:cjs &&
|
|
45
|
+
"build": "rimraf build && npm run build:esm && npm run build:cjs && npm run fixup",
|
|
46
|
+
"fixup": "node ./fixup.mjs",
|
|
46
47
|
"lint": "eslint . --ext .ts",
|
|
47
48
|
"lint:fix": "eslint . --ext .ts --fix",
|
|
48
49
|
"prepublishOnly": "npm run lint",
|
|
@@ -58,8 +59,8 @@
|
|
|
58
59
|
"devDependencies": {
|
|
59
60
|
"@eslint/js": "^9.26.0",
|
|
60
61
|
"@types/node": "^22.15.3",
|
|
61
|
-
"@vitest/coverage-v8": "^
|
|
62
|
-
"@vitest/ui": "^
|
|
62
|
+
"@vitest/coverage-v8": "^4.0.18",
|
|
63
|
+
"@vitest/ui": "^4.0.18",
|
|
63
64
|
"cross-env": "^7.0.3",
|
|
64
65
|
"eslint": "^9.26.0",
|
|
65
66
|
"rimraf": "^6.0.1",
|
|
@@ -67,6 +68,6 @@
|
|
|
67
68
|
"typedoc": "^0.28.3",
|
|
68
69
|
"typescript": "^5.8.3",
|
|
69
70
|
"typescript-eslint": "^8.31.1",
|
|
70
|
-
"vitest": "^
|
|
71
|
+
"vitest": "^4.0.18"
|
|
71
72
|
}
|
|
72
73
|
}
|