xref: /third_party/node/deps/npm/node_modules/ip-address/dist/common.js
  • Home
  • History
  • Annotate Annotate
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
  • only in /third_party/node/deps/npm/node_modules/ip-address/dist/
11cb0ef41Sopenharmony_ci"use strict";
21cb0ef41Sopenharmony_ciObject.defineProperty(exports, "__esModule", { value: true });
31cb0ef41Sopenharmony_ciexports.isCorrect = exports.isInSubnet = void 0;
41cb0ef41Sopenharmony_cifunction isInSubnet(address) {
51cb0ef41Sopenharmony_ci    if (this.subnetMask < address.subnetMask) {
61cb0ef41Sopenharmony_ci        return false;
71cb0ef41Sopenharmony_ci    }
81cb0ef41Sopenharmony_ci    if (this.mask(address.subnetMask) === address.mask()) {
91cb0ef41Sopenharmony_ci        return true;
101cb0ef41Sopenharmony_ci    }
111cb0ef41Sopenharmony_ci    return false;
121cb0ef41Sopenharmony_ci}
131cb0ef41Sopenharmony_ciexports.isInSubnet = isInSubnet;
141cb0ef41Sopenharmony_cifunction isCorrect(defaultBits) {
151cb0ef41Sopenharmony_ci    return function () {
161cb0ef41Sopenharmony_ci        if (this.addressMinusSuffix !== this.correctForm()) {
171cb0ef41Sopenharmony_ci            return false;
181cb0ef41Sopenharmony_ci        }
191cb0ef41Sopenharmony_ci        if (this.subnetMask === defaultBits && !this.parsedSubnet) {
201cb0ef41Sopenharmony_ci            return true;
211cb0ef41Sopenharmony_ci        }
221cb0ef41Sopenharmony_ci        return this.parsedSubnet === String(this.subnetMask);
231cb0ef41Sopenharmony_ci    };
241cb0ef41Sopenharmony_ci}
251cb0ef41Sopenharmony_ciexports.isCorrect = isCorrect;
261cb0ef41Sopenharmony_ci//# sourceMappingURL=common.js.map

Indexes created Thu Nov 07 10:32:03 CST 2024