Back | Home
الـ Path الحالي: /home/picotech/domains/instantly.picotech.app/public_html/public/uploads/../uploads/../../../../instantly.picotech.app/homes/../../wa.picotech.app/public_html/node_modules/path-exists/../duplexify/../safe-stable-stringify/../css-what/../validator/lib
الملفات الموجودة في هذا الـ Path:
.
..
alpha.js
blacklist.js
contains.js
equals.js
escape.js
isAfter.js
isAlpha.js
isAlphanumeric.js
isAscii.js
isBIC.js
isBase32.js
isBase58.js
isBase64.js
isBefore.js
isBoolean.js
isBtcAddress.js
isByteLength.js
isCreditCard.js
isCurrency.js
isDataURI.js
isDate.js
isDecimal.js
isDivisibleBy.js
isEAN.js
isEmail.js
isEmpty.js
isEthereumAddress.js
isFQDN.js
isFloat.js
isFullWidth.js
isHSL.js
isHalfWidth.js
isHash.js
isHexColor.js
isHexadecimal.js
isIBAN.js
isIMEI.js
isIP.js
isIPRange.js
isISBN.js
isISIN.js
isISO31661Alpha2.js
isISO31661Alpha3.js
isISO4217.js
isISO6346.js
isISO6391.js
isISO8601.js
isISRC.js
isISSN.js
isIdentityCard.js
isIn.js
isInt.js
isJSON.js
isJWT.js
isLatLong.js
isLength.js
isLicensePlate.js
isLocale.js
isLowercase.js
isLuhnNumber.js
isLuhnValid.js
isMACAddress.js
isMD5.js
isMagnetURI.js
isMailtoURI.js
isMimeType.js
isMobilePhone.js
isMongoId.js
isMultibyte.js
isNumeric.js
isOctal.js
isPassportNumber.js
isPort.js
isPostalCode.js
isRFC3339.js
isRgbColor.js
isSemVer.js
isSlug.js
isStrongPassword.js
isSurrogatePair.js
isTaxID.js
isTime.js
isURL.js
isUUID.js
isUppercase.js
isVAT.js
isVariableWidth.js
isWhitelisted.js
ltrim.js
matches.js
normalizeEmail.js
rtrim.js
stripLow.js
toBoolean.js
toDate.js
toFloat.js
toInt.js
trim.js
unescape.js
util
whitelist.js

مشاهدة ملف: isIP.js

"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = isIP;

var _assertString = _interopRequireDefault(require("./util/assertString"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

/**
11.3.  Examples

   The following addresses

             fe80::1234 (on the 1st link of the node)
             ff02::5678 (on the 5th link of the node)
             ff08::9abc (on the 10th organization of the node)

   would be represented as follows:

             fe80::1234%1
             ff02::5678%5
             ff08::9abc%10

   (Here we assume a natural translation from a zone index to the
   <zone_id> part, where the Nth zone of any scope is translated into
   "N".)

   If we use interface names as <zone_id>, those addresses could also be
   represented as follows:

            fe80::1234%ne0
            ff02::5678%pvc1.3
            ff08::9abc%interface10

   where the interface "ne0" belongs to the 1st link, "pvc1.3" belongs
   to the 5th link, and "interface10" belongs to the 10th organization.
 * * */
var IPv4SegmentFormat = '(?:[0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])';
var IPv4AddressFormat = "(".concat(IPv4SegmentFormat, "[.]){3}").concat(IPv4SegmentFormat);
var IPv4AddressRegExp = new RegExp("^".concat(IPv4AddressFormat, "$"));
var IPv6SegmentFormat = '(?:[0-9a-fA-F]{1,4})';
var IPv6AddressRegExp = new RegExp('^(' + "(?:".concat(IPv6SegmentFormat, ":){7}(?:").concat(IPv6SegmentFormat, "|:)|") + "(?:".concat(IPv6SegmentFormat, ":){6}(?:").concat(IPv4AddressFormat, "|:").concat(IPv6SegmentFormat, "|:)|") + "(?:".concat(IPv6SegmentFormat, ":){5}(?::").concat(IPv4AddressFormat, "|(:").concat(IPv6SegmentFormat, "){1,2}|:)|") + "(?:".concat(IPv6SegmentFormat, ":){4}(?:(:").concat(IPv6SegmentFormat, "){0,1}:").concat(IPv4AddressFormat, "|(:").concat(IPv6SegmentFormat, "){1,3}|:)|") + "(?:".concat(IPv6SegmentFormat, ":){3}(?:(:").concat(IPv6SegmentFormat, "){0,2}:").concat(IPv4AddressFormat, "|(:").concat(IPv6SegmentFormat, "){1,4}|:)|") + "(?:".concat(IPv6SegmentFormat, ":){2}(?:(:").concat(IPv6SegmentFormat, "){0,3}:").concat(IPv4AddressFormat, "|(:").concat(IPv6SegmentFormat, "){1,5}|:)|") + "(?:".concat(IPv6SegmentFormat, ":){1}(?:(:").concat(IPv6SegmentFormat, "){0,4}:").concat(IPv4AddressFormat, "|(:").concat(IPv6SegmentFormat, "){1,6}|:)|") + "(?::((?::".concat(IPv6SegmentFormat, "){0,5}:").concat(IPv4AddressFormat, "|(?::").concat(IPv6SegmentFormat, "){1,7}|:))") + ')(%[0-9a-zA-Z-.:]{1,})?$');

function isIP(str) {
  var version = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
  (0, _assertString.default)(str);
  version = String(version);

  if (!version) {
    return isIP(str, 4) || isIP(str, 6);
  }

  if (version === '4') {
    return IPv4AddressRegExp.test(str);
  }

  if (version === '6') {
    return IPv6AddressRegExp.test(str);
  }

  return false;
}

module.exports = exports.default;
module.exports.default = exports.default;