common.js 770 B

1234567891011121314151617181920212223242526
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", { value: true });
  3. exports.isCorrect = exports.isInSubnet = void 0;
  4. function isInSubnet(address) {
  5. if (this.subnetMask < address.subnetMask) {
  6. return false;
  7. }
  8. if (this.mask(address.subnetMask) === address.mask()) {
  9. return true;
  10. }
  11. return false;
  12. }
  13. exports.isInSubnet = isInSubnet;
  14. function isCorrect(defaultBits) {
  15. return function () {
  16. if (this.addressMinusSuffix !== this.correctForm()) {
  17. return false;
  18. }
  19. if (this.subnetMask === defaultBits && !this.parsedSubnet) {
  20. return true;
  21. }
  22. return this.parsedSubnet === String(this.subnetMask);
  23. };
  24. }
  25. exports.isCorrect = isCorrect;
  26. //# sourceMappingURL=common.js.map