@icazemier/gibbons 6.0.0-beta.2 → 6.0.0
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.d.ts +5 -5
- package/build/cjs/gibbon.js +7 -7
- package/build/esm/gibbon.d.ts +5 -5
- package/build/esm/gibbon.js +7 -7
- package/package.json +1 -1
package/build/cjs/gibbon.d.ts
CHANGED
|
@@ -101,7 +101,7 @@ export declare class Gibbon {
|
|
|
101
101
|
*/
|
|
102
102
|
isPosition(position: number): boolean;
|
|
103
103
|
/**
|
|
104
|
-
* Merge with
|
|
104
|
+
* Merge with incoming bytes
|
|
105
105
|
* @param {Gibbon} gibbon
|
|
106
106
|
* @returns {Gibbon} - Return itself for chaining purposes
|
|
107
107
|
*/
|
|
@@ -118,7 +118,7 @@ export declare class Gibbon {
|
|
|
118
118
|
* - A negative position means this position should be set logical '0'
|
|
119
119
|
*
|
|
120
120
|
* When one wants to check on bit positions outside the memory bounds (dataViewBounds), <br>
|
|
121
|
-
* method
|
|
121
|
+
* method will return early with `false`.
|
|
122
122
|
*
|
|
123
123
|
*
|
|
124
124
|
* @example
|
|
@@ -160,7 +160,7 @@ export declare class Gibbon {
|
|
|
160
160
|
* When any of the positions conforms to logical '1' (true), we return `true` early.<br><br>
|
|
161
161
|
*
|
|
162
162
|
* When one wants to check on bit positions outside the memory bounds (dataViewBounds), <br>
|
|
163
|
-
* method
|
|
163
|
+
* method will return early with `false`.
|
|
164
164
|
*
|
|
165
165
|
*
|
|
166
166
|
* @example
|
|
@@ -176,7 +176,7 @@ export declare class Gibbon {
|
|
|
176
176
|
* ```
|
|
177
177
|
* // Set 2 bit positions to logical '1' then the first bit position back to '0'
|
|
178
178
|
* const gibbon = Gibbon.create(2);
|
|
179
|
-
* gibbon.setPosition(1).setPosition(2)
|
|
179
|
+
* gibbon.setPosition(1).setPosition(2).togglePosition(1);
|
|
180
180
|
*
|
|
181
181
|
* gibbon.hasAllFromPositions([-1, 100]); // true
|
|
182
182
|
* ```
|
|
@@ -238,7 +238,7 @@ export declare class Gibbon {
|
|
|
238
238
|
*/
|
|
239
239
|
static decode(data: Buffer | string): Gibbon;
|
|
240
240
|
/**
|
|
241
|
-
* Depending on the GIBBONS_ENCODE_FROM_TO_STRING environment variable
|
|
241
|
+
* Depending on the GIBBONS_ENCODE_FROM_TO_STRING environment variable it converts this
|
|
242
242
|
* Gibbon to a `string` or `Buffer`
|
|
243
243
|
*
|
|
244
244
|
* @returns {Buffer|string}
|
package/build/cjs/gibbon.js
CHANGED
|
@@ -192,7 +192,7 @@ class Gibbon {
|
|
|
192
192
|
return gibbon_processor_js_1.GibbonProcessor.isTrue(byte, bitBytePosition.bitPos);
|
|
193
193
|
}
|
|
194
194
|
/**
|
|
195
|
-
* Merge with
|
|
195
|
+
* Merge with incoming bytes
|
|
196
196
|
* @param {Gibbon} gibbon
|
|
197
197
|
* @returns {Gibbon} - Return itself for chaining purposes
|
|
198
198
|
*/
|
|
@@ -206,8 +206,8 @@ class Gibbon {
|
|
|
206
206
|
const byteLength = Math.min(thisDataView.byteLength, incomingDataView.byteLength);
|
|
207
207
|
for (let i = 0; i < byteLength; i++) {
|
|
208
208
|
const thisByte = thisDataView.getUint8(i);
|
|
209
|
-
const
|
|
210
|
-
thisDataView.setUint8(i, thisByte |
|
|
209
|
+
const incomingByte = incomingDataView.getUint8(i);
|
|
210
|
+
thisDataView.setUint8(i, thisByte | incomingByte);
|
|
211
211
|
}
|
|
212
212
|
return this;
|
|
213
213
|
}
|
|
@@ -234,7 +234,7 @@ class Gibbon {
|
|
|
234
234
|
* - A negative position means this position should be set logical '0'
|
|
235
235
|
*
|
|
236
236
|
* When one wants to check on bit positions outside the memory bounds (dataViewBounds), <br>
|
|
237
|
-
* method
|
|
237
|
+
* method will return early with `false`.
|
|
238
238
|
*
|
|
239
239
|
*
|
|
240
240
|
* @example
|
|
@@ -293,7 +293,7 @@ class Gibbon {
|
|
|
293
293
|
* When any of the positions conforms to logical '1' (true), we return `true` early.<br><br>
|
|
294
294
|
*
|
|
295
295
|
* When one wants to check on bit positions outside the memory bounds (dataViewBounds), <br>
|
|
296
|
-
* method
|
|
296
|
+
* method will return early with `false`.
|
|
297
297
|
*
|
|
298
298
|
*
|
|
299
299
|
* @example
|
|
@@ -309,7 +309,7 @@ class Gibbon {
|
|
|
309
309
|
* ```
|
|
310
310
|
* // Set 2 bit positions to logical '1' then the first bit position back to '0'
|
|
311
311
|
* const gibbon = Gibbon.create(2);
|
|
312
|
-
* gibbon.setPosition(1).setPosition(2)
|
|
312
|
+
* gibbon.setPosition(1).setPosition(2).togglePosition(1);
|
|
313
313
|
*
|
|
314
314
|
* gibbon.hasAllFromPositions([-1, 100]); // true
|
|
315
315
|
* ```
|
|
@@ -405,7 +405,7 @@ class Gibbon {
|
|
|
405
405
|
throw new TypeError(`Expected a string or Buffer for decoding, but received a: ${typeof data}`);
|
|
406
406
|
}
|
|
407
407
|
/**
|
|
408
|
-
* Depending on the GIBBONS_ENCODE_FROM_TO_STRING environment variable
|
|
408
|
+
* Depending on the GIBBONS_ENCODE_FROM_TO_STRING environment variable it converts this
|
|
409
409
|
* Gibbon to a `string` or `Buffer`
|
|
410
410
|
*
|
|
411
411
|
* @returns {Buffer|string}
|
package/build/esm/gibbon.d.ts
CHANGED
|
@@ -101,7 +101,7 @@ export declare class Gibbon {
|
|
|
101
101
|
*/
|
|
102
102
|
isPosition(position: number): boolean;
|
|
103
103
|
/**
|
|
104
|
-
* Merge with
|
|
104
|
+
* Merge with incoming bytes
|
|
105
105
|
* @param {Gibbon} gibbon
|
|
106
106
|
* @returns {Gibbon} - Return itself for chaining purposes
|
|
107
107
|
*/
|
|
@@ -118,7 +118,7 @@ export declare class Gibbon {
|
|
|
118
118
|
* - A negative position means this position should be set logical '0'
|
|
119
119
|
*
|
|
120
120
|
* When one wants to check on bit positions outside the memory bounds (dataViewBounds), <br>
|
|
121
|
-
* method
|
|
121
|
+
* method will return early with `false`.
|
|
122
122
|
*
|
|
123
123
|
*
|
|
124
124
|
* @example
|
|
@@ -160,7 +160,7 @@ export declare class Gibbon {
|
|
|
160
160
|
* When any of the positions conforms to logical '1' (true), we return `true` early.<br><br>
|
|
161
161
|
*
|
|
162
162
|
* When one wants to check on bit positions outside the memory bounds (dataViewBounds), <br>
|
|
163
|
-
* method
|
|
163
|
+
* method will return early with `false`.
|
|
164
164
|
*
|
|
165
165
|
*
|
|
166
166
|
* @example
|
|
@@ -176,7 +176,7 @@ export declare class Gibbon {
|
|
|
176
176
|
* ```
|
|
177
177
|
* // Set 2 bit positions to logical '1' then the first bit position back to '0'
|
|
178
178
|
* const gibbon = Gibbon.create(2);
|
|
179
|
-
* gibbon.setPosition(1).setPosition(2)
|
|
179
|
+
* gibbon.setPosition(1).setPosition(2).togglePosition(1);
|
|
180
180
|
*
|
|
181
181
|
* gibbon.hasAllFromPositions([-1, 100]); // true
|
|
182
182
|
* ```
|
|
@@ -238,7 +238,7 @@ export declare class Gibbon {
|
|
|
238
238
|
*/
|
|
239
239
|
static decode(data: Buffer | string): Gibbon;
|
|
240
240
|
/**
|
|
241
|
-
* Depending on the GIBBONS_ENCODE_FROM_TO_STRING environment variable
|
|
241
|
+
* Depending on the GIBBONS_ENCODE_FROM_TO_STRING environment variable it converts this
|
|
242
242
|
* Gibbon to a `string` or `Buffer`
|
|
243
243
|
*
|
|
244
244
|
* @returns {Buffer|string}
|
package/build/esm/gibbon.js
CHANGED
|
@@ -191,7 +191,7 @@ export class Gibbon {
|
|
|
191
191
|
return GibbonProcessor.isTrue(byte, bitBytePosition.bitPos);
|
|
192
192
|
}
|
|
193
193
|
/**
|
|
194
|
-
* Merge with
|
|
194
|
+
* Merge with incoming bytes
|
|
195
195
|
* @param {Gibbon} gibbon
|
|
196
196
|
* @returns {Gibbon} - Return itself for chaining purposes
|
|
197
197
|
*/
|
|
@@ -205,8 +205,8 @@ export class Gibbon {
|
|
|
205
205
|
const byteLength = Math.min(thisDataView.byteLength, incomingDataView.byteLength);
|
|
206
206
|
for (let i = 0; i < byteLength; i++) {
|
|
207
207
|
const thisByte = thisDataView.getUint8(i);
|
|
208
|
-
const
|
|
209
|
-
thisDataView.setUint8(i, thisByte |
|
|
208
|
+
const incomingByte = incomingDataView.getUint8(i);
|
|
209
|
+
thisDataView.setUint8(i, thisByte | incomingByte);
|
|
210
210
|
}
|
|
211
211
|
return this;
|
|
212
212
|
}
|
|
@@ -233,7 +233,7 @@ export class Gibbon {
|
|
|
233
233
|
* - A negative position means this position should be set logical '0'
|
|
234
234
|
*
|
|
235
235
|
* When one wants to check on bit positions outside the memory bounds (dataViewBounds), <br>
|
|
236
|
-
* method
|
|
236
|
+
* method will return early with `false`.
|
|
237
237
|
*
|
|
238
238
|
*
|
|
239
239
|
* @example
|
|
@@ -292,7 +292,7 @@ export class Gibbon {
|
|
|
292
292
|
* When any of the positions conforms to logical '1' (true), we return `true` early.<br><br>
|
|
293
293
|
*
|
|
294
294
|
* When one wants to check on bit positions outside the memory bounds (dataViewBounds), <br>
|
|
295
|
-
* method
|
|
295
|
+
* method will return early with `false`.
|
|
296
296
|
*
|
|
297
297
|
*
|
|
298
298
|
* @example
|
|
@@ -308,7 +308,7 @@ export class Gibbon {
|
|
|
308
308
|
* ```
|
|
309
309
|
* // Set 2 bit positions to logical '1' then the first bit position back to '0'
|
|
310
310
|
* const gibbon = Gibbon.create(2);
|
|
311
|
-
* gibbon.setPosition(1).setPosition(2)
|
|
311
|
+
* gibbon.setPosition(1).setPosition(2).togglePosition(1);
|
|
312
312
|
*
|
|
313
313
|
* gibbon.hasAllFromPositions([-1, 100]); // true
|
|
314
314
|
* ```
|
|
@@ -404,7 +404,7 @@ export class Gibbon {
|
|
|
404
404
|
throw new TypeError(`Expected a string or Buffer for decoding, but received a: ${typeof data}`);
|
|
405
405
|
}
|
|
406
406
|
/**
|
|
407
|
-
* Depending on the GIBBONS_ENCODE_FROM_TO_STRING environment variable
|
|
407
|
+
* Depending on the GIBBONS_ENCODE_FROM_TO_STRING environment variable it converts this
|
|
408
408
|
* Gibbon to a `string` or `Buffer`
|
|
409
409
|
*
|
|
410
410
|
* @returns {Buffer|string}
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@icazemier/gibbons",
|
|
3
3
|
"type": "module",
|
|
4
4
|
"private": false,
|
|
5
|
-
"version": "6.0.0
|
|
5
|
+
"version": "6.0.0",
|
|
6
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
|
{
|