Socket
Socket
Sign inDemoInstall

validator

Package Overview
Dependencies
0
Maintainers
2
Versions
210
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 13.5.1 to 13.5.2

2

es/index.js

@@ -92,3 +92,3 @@ import toDate from './lib/toDate';

import isVAT from './lib/isVAT';
var version = '13.5.1';
var version = '13.5.2';
var validator = {

@@ -95,0 +95,0 @@ version: version,

@@ -19,13 +19,11 @@ import assertString from './util/assertString';

var parts = str.split('.');
var tld = parts[parts.length - 1];
for (var i = 0; i < parts.length; i++) {
if (parts[i].length > 63) {
if (options.require_tld) {
// disallow fqdns without tld
if (parts.length < 2) {
return false;
}
}
if (options.require_tld) {
var tld = parts.pop();
if (!parts.length || !/^([a-z\u00a1-\uffff]{2,}|xn[a-z0-9-]{2,})$/i.test(tld)) {
if (!/^([a-z\u00a1-\uffff]{2,}|xn[a-z0-9-]{2,})$/i.test(tld)) {
return false;

@@ -38,9 +36,12 @@ } // disallow spaces && special characers

}
} // reject numeric TLDs
if (!options.allow_numeric_tld && /^\d+$/.test(tld)) {
return false;
}
for (var part, _i = 0; _i < parts.length; _i++) {
part = parts[_i];
if (!options.allow_numeric_tld && _i === parts.length - 1 && /^\d+$/.test(part)) {
return false; // reject numeric TLDs
return parts.every(function (part) {
if (part.length > 63) {
return false;
}

@@ -55,5 +56,6 @@

return false;
}
} // disallow parts starting or ending with hyphen
if (part[0] === '-' || part[part.length - 1] === '-') {
if (/^-|-$/.test(part)) {
return false;

@@ -65,5 +67,5 @@ }

}
}
return true;
return true;
});
}

@@ -198,3 +198,3 @@ "use strict";

var version = '13.5.1';
var version = '13.5.2';
var validator = {

@@ -201,0 +201,0 @@ version: version,

@@ -31,13 +31,11 @@ "use strict";

var parts = str.split('.');
var tld = parts[parts.length - 1];
for (var i = 0; i < parts.length; i++) {
if (parts[i].length > 63) {
if (options.require_tld) {
// disallow fqdns without tld
if (parts.length < 2) {
return false;
}
}
if (options.require_tld) {
var tld = parts.pop();
if (!parts.length || !/^([a-z\u00a1-\uffff]{2,}|xn[a-z0-9-]{2,})$/i.test(tld)) {
if (!/^([a-z\u00a1-\uffff]{2,}|xn[a-z0-9-]{2,})$/i.test(tld)) {
return false;

@@ -50,9 +48,12 @@ } // disallow spaces && special characers

}
} // reject numeric TLDs
if (!options.allow_numeric_tld && /^\d+$/.test(tld)) {
return false;
}
for (var part, _i = 0; _i < parts.length; _i++) {
part = parts[_i];
if (!options.allow_numeric_tld && _i === parts.length - 1 && /^\d+$/.test(part)) {
return false; // reject numeric TLDs
return parts.every(function (part) {
if (part.length > 63) {
return false;
}

@@ -67,5 +68,6 @@

return false;
}
} // disallow parts starting or ending with hyphen
if (part[0] === '-' || part[part.length - 1] === '-') {
if (/^-|-$/.test(part)) {
return false;

@@ -77,5 +79,5 @@ }

}
}
return true;
return true;
});
}

@@ -82,0 +84,0 @@

{
"name": "validator",
"description": "String validation and sanitization",
"version": "13.5.1",
"version": "13.5.2",
"sideEffects": false,

@@ -6,0 +6,0 @@ "homepage": "https://github.com/chriso/validator.js",

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc