@bigbinary/neeto-molecules 4.1.22 → 4.1.24
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/dist/IpRestriction.js +86 -93
- package/dist/IpRestriction.js.map +1 -1
- package/dist/cjs/IpRestriction.js +86 -93
- package/dist/cjs/IpRestriction.js.map +1 -1
- package/package.json +1 -1
package/dist/IpRestriction.js
CHANGED
|
@@ -345,93 +345,86 @@ function requireIPv6Utils () {
|
|
|
345
345
|
|
|
346
346
|
var HexadecimalUtils = {};
|
|
347
347
|
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
}, '');
|
|
429
|
-
};
|
|
430
|
-
exports$1.hexadectetNotationToBinaryString = hexadectetNotationToBinaryString;
|
|
431
|
-
|
|
432
|
-
} (HexadecimalUtils));
|
|
433
|
-
return HexadecimalUtils;
|
|
434
|
-
}
|
|
348
|
+
(function (exports$1) {
|
|
349
|
+
Object.defineProperty(exports$1, "__esModule", { value: true });
|
|
350
|
+
exports$1.hexadectetNotationToBinaryString = exports$1.binaryStringToHexadecimalString = exports$1.colonHexadecimalNotationToBinaryString = exports$1.hexadecimalStringToHexadecatetString = exports$1.hexadecimalStringToBinaryString = exports$1.bigIntToHexadecimalString = void 0;
|
|
351
|
+
const IPv6Utils_1 = requireIPv6Utils();
|
|
352
|
+
const BinaryUtils_1 = BinaryUtils;
|
|
353
|
+
/**
|
|
354
|
+
* Converts a given bigint number to a hexadecimal string
|
|
355
|
+
* @param num the bigint number
|
|
356
|
+
* @returns {string} the hexadeciaml string
|
|
357
|
+
*/
|
|
358
|
+
let bigIntToHexadecimalString = (num) => {
|
|
359
|
+
return num.toString(16);
|
|
360
|
+
};
|
|
361
|
+
exports$1.bigIntToHexadecimalString = bigIntToHexadecimalString;
|
|
362
|
+
/**
|
|
363
|
+
* Converts a number in hexadecimal (base 16) to binary string
|
|
364
|
+
* @param {string} hexadecimalString the number in base 16
|
|
365
|
+
* @returns {string} the number converted to base 2
|
|
366
|
+
*/
|
|
367
|
+
let hexadecimalStringToBinaryString = (hexadecimalString) => {
|
|
368
|
+
let inDecimal = BigInt(`0x${hexadecimalString}`);
|
|
369
|
+
return inDecimal.toString(2);
|
|
370
|
+
};
|
|
371
|
+
exports$1.hexadecimalStringToBinaryString = hexadecimalStringToBinaryString;
|
|
372
|
+
/**
|
|
373
|
+
* Converts a number in hexadecimal (base 16) to binary hexadecatet string.
|
|
374
|
+
* This means the bits in the output cannot be more than 16
|
|
375
|
+
*
|
|
376
|
+
* @param hexadecimalString {string} the number converted to binary hexadecatet string
|
|
377
|
+
*/
|
|
378
|
+
let hexadecimalStringToHexadecatetString = (hexadecimalString) => {
|
|
379
|
+
let binaryString = (0, exports$1.hexadecimalStringToBinaryString)(hexadecimalString);
|
|
380
|
+
let length = binaryString.length;
|
|
381
|
+
if (length > 16) {
|
|
382
|
+
throw new Error("Given decimal in binary contains digits greater than an Hexadecatet");
|
|
383
|
+
}
|
|
384
|
+
return (0, BinaryUtils_1.leftPadWithZeroBit)(binaryString, 16);
|
|
385
|
+
};
|
|
386
|
+
exports$1.hexadecimalStringToHexadecatetString = hexadecimalStringToHexadecatetString;
|
|
387
|
+
/**
|
|
388
|
+
* Given an IPv6 number in hexadecimal notated string, e.g 2001:0db8:0000:0000:0000:0000:0000:0000 converts it to
|
|
389
|
+
* binary string
|
|
390
|
+
*
|
|
391
|
+
* @param hexadecimalString IPv6 string
|
|
392
|
+
* @returns {string} the binary value of the given ipv6 number in string
|
|
393
|
+
*/
|
|
394
|
+
let colonHexadecimalNotationToBinaryString = (hexadecimalString) => {
|
|
395
|
+
let expandedIPv6 = (0, IPv6Utils_1.expandIPv6Number)(hexadecimalString);
|
|
396
|
+
let stringHexadecimal = expandedIPv6.split(":");
|
|
397
|
+
return stringHexadecimal.reduce((binaryAsString, hexidecimal) => {
|
|
398
|
+
return binaryAsString.concat((0, exports$1.hexadecimalStringToHexadecatetString)(hexidecimal));
|
|
399
|
+
}, '');
|
|
400
|
+
};
|
|
401
|
+
exports$1.colonHexadecimalNotationToBinaryString = colonHexadecimalNotationToBinaryString;
|
|
402
|
+
/**
|
|
403
|
+
* Converts number in binary string to hexadecimal string
|
|
404
|
+
* @param {string} num in binary string
|
|
405
|
+
* @returns {string} num in hexadecimal string
|
|
406
|
+
*/
|
|
407
|
+
let binaryStringToHexadecimalString = (num) => {
|
|
408
|
+
// first convert to binary string to decimal (big Integer)
|
|
409
|
+
let inDecimal = BigInt(`0b${num}`);
|
|
410
|
+
return inDecimal.toString(16);
|
|
411
|
+
};
|
|
412
|
+
exports$1.binaryStringToHexadecimalString = binaryStringToHexadecimalString;
|
|
413
|
+
/**
|
|
414
|
+
* Converts a given IPv6 number expressed in the hexadecimal string notation into a 16 bit binary number in string
|
|
415
|
+
* @param {string} hexadectetString the IPv6 number
|
|
416
|
+
* @returns {string} the IPv6 number converted to binary string
|
|
417
|
+
*/
|
|
418
|
+
let hexadectetNotationToBinaryString = (hexadectetString) => {
|
|
419
|
+
let expand = (0, IPv6Utils_1.expandIPv6Number)(hexadectetString);
|
|
420
|
+
let hexadecimals = expand.split(":");
|
|
421
|
+
return hexadecimals.reduce((hexadecimalAsString, hexavalue) => {
|
|
422
|
+
return hexadecimalAsString.concat((0, BinaryUtils_1.leftPadWithZeroBit)((0, exports$1.hexadecimalStringToBinaryString)(hexavalue), 16));
|
|
423
|
+
}, '');
|
|
424
|
+
};
|
|
425
|
+
exports$1.hexadectetNotationToBinaryString = hexadectetNotationToBinaryString;
|
|
426
|
+
|
|
427
|
+
} (HexadecimalUtils));
|
|
435
428
|
|
|
436
429
|
var hasRequiredValidator;
|
|
437
430
|
|
|
@@ -443,8 +436,8 @@ function requireValidator () {
|
|
|
443
436
|
const BinaryUtils_1 = BinaryUtils;
|
|
444
437
|
const BinaryUtils_2 = BinaryUtils;
|
|
445
438
|
const IPv6Utils_1 = requireIPv6Utils();
|
|
446
|
-
const HexadecimalUtils_1 =
|
|
447
|
-
const HexadecimalUtils_2 =
|
|
439
|
+
const HexadecimalUtils_1 = HexadecimalUtils;
|
|
440
|
+
const HexadecimalUtils_2 = HexadecimalUtils;
|
|
448
441
|
let Validator$1 = class Validator {
|
|
449
442
|
/**
|
|
450
443
|
* Checks if given ipNumber is in between the given lower and upper bound
|
|
@@ -941,9 +934,9 @@ const BinaryUtils_2 = BinaryUtils;
|
|
|
941
934
|
const BinaryUtils_3 = BinaryUtils;
|
|
942
935
|
const BinaryUtils_4 = BinaryUtils;
|
|
943
936
|
const Hexadecatet_1$1 = Hexadecatet$1;
|
|
944
|
-
const HexadecimalUtils_1$1 =
|
|
937
|
+
const HexadecimalUtils_1$1 = HexadecimalUtils;
|
|
945
938
|
const IPv6Utils_1 = requireIPv6Utils();
|
|
946
|
-
const HexadecimalUtils_2 =
|
|
939
|
+
const HexadecimalUtils_2 = HexadecimalUtils;
|
|
947
940
|
/**
|
|
948
941
|
* Provides the implementation of functionality that are common
|
|
949
942
|
* to {@link IPv4}, {@link IPv6}, {@link IPv4Mask} and {@link IPv6Mask}
|
|
@@ -1694,7 +1687,7 @@ Prefix.isIPv4Prefix = isIPv4Prefix;
|
|
|
1694
1687
|
const Validator_1$1 = requireValidator();
|
|
1695
1688
|
const IPNumber_1$1 = IPNumber;
|
|
1696
1689
|
const BinaryUtils_1$1 = BinaryUtils;
|
|
1697
|
-
const HexadecimalUtils_1 =
|
|
1690
|
+
const HexadecimalUtils_1 = HexadecimalUtils;
|
|
1698
1691
|
const Hexadecatet_1 = Hexadecatet$1;
|
|
1699
1692
|
/**
|
|
1700
1693
|
* Represents the prefix portion in the CIDR notation for representing IP ranges
|
|
@@ -3192,7 +3185,7 @@ class SortedSet {
|
|
|
3192
3185
|
*/
|
|
3193
3186
|
__exportStar(BinaryUtils, exports$1);
|
|
3194
3187
|
__exportStar(Hexadecatet$1, exports$1);
|
|
3195
|
-
__exportStar(
|
|
3188
|
+
__exportStar(HexadecimalUtils, exports$1);
|
|
3196
3189
|
__exportStar(IPNumber, exports$1);
|
|
3197
3190
|
__exportStar(IPNumType, exports$1);
|
|
3198
3191
|
__exportStar(IPPool, exports$1);
|