@bigbinary/neeto-molecules 4.1.21 → 4.1.23
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
|
@@ -366,93 +366,86 @@ function requireIPv6Utils () {
|
|
|
366
366
|
|
|
367
367
|
var HexadecimalUtils = {};
|
|
368
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
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
}, '');
|
|
450
|
-
};
|
|
451
|
-
exports$1.hexadectetNotationToBinaryString = hexadectetNotationToBinaryString;
|
|
452
|
-
|
|
453
|
-
} (HexadecimalUtils));
|
|
454
|
-
return HexadecimalUtils;
|
|
455
|
-
}
|
|
369
|
+
(function (exports$1) {
|
|
370
|
+
Object.defineProperty(exports$1, "__esModule", { value: true });
|
|
371
|
+
exports$1.hexadectetNotationToBinaryString = exports$1.binaryStringToHexadecimalString = exports$1.colonHexadecimalNotationToBinaryString = exports$1.hexadecimalStringToHexadecatetString = exports$1.hexadecimalStringToBinaryString = exports$1.bigIntToHexadecimalString = void 0;
|
|
372
|
+
const IPv6Utils_1 = requireIPv6Utils();
|
|
373
|
+
const BinaryUtils_1 = BinaryUtils;
|
|
374
|
+
/**
|
|
375
|
+
* Converts a given bigint number to a hexadecimal string
|
|
376
|
+
* @param num the bigint number
|
|
377
|
+
* @returns {string} the hexadeciaml string
|
|
378
|
+
*/
|
|
379
|
+
let bigIntToHexadecimalString = (num) => {
|
|
380
|
+
return num.toString(16);
|
|
381
|
+
};
|
|
382
|
+
exports$1.bigIntToHexadecimalString = bigIntToHexadecimalString;
|
|
383
|
+
/**
|
|
384
|
+
* Converts a number in hexadecimal (base 16) to binary string
|
|
385
|
+
* @param {string} hexadecimalString the number in base 16
|
|
386
|
+
* @returns {string} the number converted to base 2
|
|
387
|
+
*/
|
|
388
|
+
let hexadecimalStringToBinaryString = (hexadecimalString) => {
|
|
389
|
+
let inDecimal = BigInt(`0x${hexadecimalString}`);
|
|
390
|
+
return inDecimal.toString(2);
|
|
391
|
+
};
|
|
392
|
+
exports$1.hexadecimalStringToBinaryString = hexadecimalStringToBinaryString;
|
|
393
|
+
/**
|
|
394
|
+
* Converts a number in hexadecimal (base 16) to binary hexadecatet string.
|
|
395
|
+
* This means the bits in the output cannot be more than 16
|
|
396
|
+
*
|
|
397
|
+
* @param hexadecimalString {string} the number converted to binary hexadecatet string
|
|
398
|
+
*/
|
|
399
|
+
let hexadecimalStringToHexadecatetString = (hexadecimalString) => {
|
|
400
|
+
let binaryString = (0, exports$1.hexadecimalStringToBinaryString)(hexadecimalString);
|
|
401
|
+
let length = binaryString.length;
|
|
402
|
+
if (length > 16) {
|
|
403
|
+
throw new Error("Given decimal in binary contains digits greater than an Hexadecatet");
|
|
404
|
+
}
|
|
405
|
+
return (0, BinaryUtils_1.leftPadWithZeroBit)(binaryString, 16);
|
|
406
|
+
};
|
|
407
|
+
exports$1.hexadecimalStringToHexadecatetString = hexadecimalStringToHexadecatetString;
|
|
408
|
+
/**
|
|
409
|
+
* Given an IPv6 number in hexadecimal notated string, e.g 2001:0db8:0000:0000:0000:0000:0000:0000 converts it to
|
|
410
|
+
* binary string
|
|
411
|
+
*
|
|
412
|
+
* @param hexadecimalString IPv6 string
|
|
413
|
+
* @returns {string} the binary value of the given ipv6 number in string
|
|
414
|
+
*/
|
|
415
|
+
let colonHexadecimalNotationToBinaryString = (hexadecimalString) => {
|
|
416
|
+
let expandedIPv6 = (0, IPv6Utils_1.expandIPv6Number)(hexadecimalString);
|
|
417
|
+
let stringHexadecimal = expandedIPv6.split(":");
|
|
418
|
+
return stringHexadecimal.reduce((binaryAsString, hexidecimal) => {
|
|
419
|
+
return binaryAsString.concat((0, exports$1.hexadecimalStringToHexadecatetString)(hexidecimal));
|
|
420
|
+
}, '');
|
|
421
|
+
};
|
|
422
|
+
exports$1.colonHexadecimalNotationToBinaryString = colonHexadecimalNotationToBinaryString;
|
|
423
|
+
/**
|
|
424
|
+
* Converts number in binary string to hexadecimal string
|
|
425
|
+
* @param {string} num in binary string
|
|
426
|
+
* @returns {string} num in hexadecimal string
|
|
427
|
+
*/
|
|
428
|
+
let binaryStringToHexadecimalString = (num) => {
|
|
429
|
+
// first convert to binary string to decimal (big Integer)
|
|
430
|
+
let inDecimal = BigInt(`0b${num}`);
|
|
431
|
+
return inDecimal.toString(16);
|
|
432
|
+
};
|
|
433
|
+
exports$1.binaryStringToHexadecimalString = binaryStringToHexadecimalString;
|
|
434
|
+
/**
|
|
435
|
+
* Converts a given IPv6 number expressed in the hexadecimal string notation into a 16 bit binary number in string
|
|
436
|
+
* @param {string} hexadectetString the IPv6 number
|
|
437
|
+
* @returns {string} the IPv6 number converted to binary string
|
|
438
|
+
*/
|
|
439
|
+
let hexadectetNotationToBinaryString = (hexadectetString) => {
|
|
440
|
+
let expand = (0, IPv6Utils_1.expandIPv6Number)(hexadectetString);
|
|
441
|
+
let hexadecimals = expand.split(":");
|
|
442
|
+
return hexadecimals.reduce((hexadecimalAsString, hexavalue) => {
|
|
443
|
+
return hexadecimalAsString.concat((0, BinaryUtils_1.leftPadWithZeroBit)((0, exports$1.hexadecimalStringToBinaryString)(hexavalue), 16));
|
|
444
|
+
}, '');
|
|
445
|
+
};
|
|
446
|
+
exports$1.hexadectetNotationToBinaryString = hexadectetNotationToBinaryString;
|
|
447
|
+
|
|
448
|
+
} (HexadecimalUtils));
|
|
456
449
|
|
|
457
450
|
var hasRequiredValidator;
|
|
458
451
|
|
|
@@ -464,8 +457,8 @@ function requireValidator () {
|
|
|
464
457
|
const BinaryUtils_1 = BinaryUtils;
|
|
465
458
|
const BinaryUtils_2 = BinaryUtils;
|
|
466
459
|
const IPv6Utils_1 = requireIPv6Utils();
|
|
467
|
-
const HexadecimalUtils_1 =
|
|
468
|
-
const HexadecimalUtils_2 =
|
|
460
|
+
const HexadecimalUtils_1 = HexadecimalUtils;
|
|
461
|
+
const HexadecimalUtils_2 = HexadecimalUtils;
|
|
469
462
|
let Validator$1 = class Validator {
|
|
470
463
|
/**
|
|
471
464
|
* Checks if given ipNumber is in between the given lower and upper bound
|
|
@@ -962,9 +955,9 @@ const BinaryUtils_2 = BinaryUtils;
|
|
|
962
955
|
const BinaryUtils_3 = BinaryUtils;
|
|
963
956
|
const BinaryUtils_4 = BinaryUtils;
|
|
964
957
|
const Hexadecatet_1$1 = Hexadecatet$1;
|
|
965
|
-
const HexadecimalUtils_1$1 =
|
|
958
|
+
const HexadecimalUtils_1$1 = HexadecimalUtils;
|
|
966
959
|
const IPv6Utils_1 = requireIPv6Utils();
|
|
967
|
-
const HexadecimalUtils_2 =
|
|
960
|
+
const HexadecimalUtils_2 = HexadecimalUtils;
|
|
968
961
|
/**
|
|
969
962
|
* Provides the implementation of functionality that are common
|
|
970
963
|
* to {@link IPv4}, {@link IPv6}, {@link IPv4Mask} and {@link IPv6Mask}
|
|
@@ -1715,7 +1708,7 @@ Prefix.isIPv4Prefix = isIPv4Prefix;
|
|
|
1715
1708
|
const Validator_1$1 = requireValidator();
|
|
1716
1709
|
const IPNumber_1$1 = IPNumber;
|
|
1717
1710
|
const BinaryUtils_1$1 = BinaryUtils;
|
|
1718
|
-
const HexadecimalUtils_1 =
|
|
1711
|
+
const HexadecimalUtils_1 = HexadecimalUtils;
|
|
1719
1712
|
const Hexadecatet_1 = Hexadecatet$1;
|
|
1720
1713
|
/**
|
|
1721
1714
|
* Represents the prefix portion in the CIDR notation for representing IP ranges
|
|
@@ -3213,7 +3206,7 @@ class SortedSet {
|
|
|
3213
3206
|
*/
|
|
3214
3207
|
__exportStar(BinaryUtils, exports$1);
|
|
3215
3208
|
__exportStar(Hexadecatet$1, exports$1);
|
|
3216
|
-
__exportStar(
|
|
3209
|
+
__exportStar(HexadecimalUtils, exports$1);
|
|
3217
3210
|
__exportStar(IPNumber, exports$1);
|
|
3218
3211
|
__exportStar(IPNumType, exports$1);
|
|
3219
3212
|
__exportStar(IPPool, exports$1);
|