Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

one-validation

Package Overview
Dependencies
Maintainers
1
Versions
39
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

one-validation - npm Package Compare versions

Comparing version 0.1.0 to 0.2.0

4

lib/tld.js

@@ -71,5 +71,5 @@ /*global require*/

console.log(regexString);
var validationJsContents = fs.readFileSync(path.resolve(__dirname, 'one/validation.js'), 'utf-8');
var validationJsContents = fs.readFileSync(path.resolve(__dirname, '../validation.js'), 'utf-8');
validationJsContents = validationJsContents.replace(/tld = \/\(\?:.*?\/i,/, "tld = /" + regexString + "/i,");
fs.writeFileSync(path.resolve(__dirname, 'one/validation.js'), validationJsContents, 'utf-8');
fs.writeFileSync(path.resolve(__dirname, '../validation.js'), validationJsContents, 'utf-8');
});

@@ -76,0 +76,0 @@ });

@@ -5,3 +5,3 @@ {

"description": "Regexp based validation collection for common internet validation tasks",
"version": "0.1.0",
"version": "0.2.0",
"repository": {

@@ -17,3 +17,7 @@ "url": "git://github.com/One-com/one-validation.git"

"uglify-js": ">=1.2.0"
}
},
"scripts": {
"prepublish": "node lib/tld.js; make"
},
"main": "./validation.js"
}

@@ -1,3 +0,5 @@

/*global Ext*/
/*global one, Ext*/
(function () {
"use strict";
var messages = {

@@ -13,7 +15,14 @@ domain: "is not a valid domain name",

Ext.require('Ext.data.validations', function () {
Ext.data.validations[name] = function (config, value) {
return (value === null && config.optional) || validation[name](value);
};
if (messages[name]) {
Ext.data.validations[name + 'Message'] = messages[name];
var name,
functions = one.validation.functions;
for (name in functions) {
if (functions.hasOwnProperty(name)) {
Ext.data.validations[name] = function (config, value) {
return (value === null && config.optional) || functions[name](value);
};
if (messages[name]) {
Ext.data.validations[name + 'Message'] = messages[name];
}
}
}

@@ -20,0 +29,0 @@ });

@@ -1,1 +0,1 @@

(function(){var a={domain:"is not a valid domain name",subdomain:"is not a valid domain name",email:"is not a valid email address",url:"is not a valid URL",mailto:"is not a valid mailto-URL"};typeof Ext!="undefined"&&Ext.require("Ext.data.validations",function(){Ext.data.validations[name]=function(a,b){return b===null&&a.optional||validation[name](b)},a[name]&&(Ext.data.validations[name+"Message"]=a[name])})})()
(function(){"use strict";var a={domain:"is not a valid domain name",subdomain:"is not a valid domain name",email:"is not a valid email address",url:"is not a valid URL",mailto:"is not a valid mailto-URL"};typeof Ext!="undefined"&&Ext.require("Ext.data.validations",function(){var b,c=one.validation.functions;for(b in c)c.hasOwnProperty(b)&&(Ext.data.validations[b]=function(a,d){return d===null&&a.optional||c[b](d)},a[b]&&(Ext.data.validations[b+"Message"]=a[b]))})})();

@@ -5,40 +5,39 @@ /*global module, window*/

(function () {
var validation = {
regex: {}
"use strict";
var name,
validation = {
functions: {}
},
install = {
},
name,
tld = /(?:a[cdefgilmnoqrstuwxz]|aero|arpa|asia|b[abdefghijmnorstvwyz]|biz|c[acdfghiklmnoruvwxyz]|cat|com|coop|d[ejkmoz]|e[cegrstu]|edu|f[ijkmor]|g[abdefghilmnpqrstuwy]|gov|h[kmnrtu]|i[delmnoqrst]|info|int|j[emop]|jobs|k[eghimnprwyz]|l[abcikrstuvy]|m[acdeghklmnopqrstuvwxyz]|mil|mobi|museum|n[acefgilopruz]|name|net|om|org|p[aefghklmnrstwy]|pro|qa|r[eosuw]|s[abcdeghijklmnortuvxyz]|t[cdfghjklmnoprtvwz]|tel|travel|u[agksyz]|v[aceginu]|w[fs]|xxx|xn--(?:0zwm56d|11b5bs3a9aj6g|3e0b707e|45brj9c|80akhbyknj4f|90a3ac|9t4b11yi5a|clchc0ea0b2g2a9gcd|deba0ad|fiqs8s|fiqz9s|fpcrj9c3d|fzc2c9e2c|g6w251d|gecrj9c|h2brj9c|hgbk6aj7f53bba|hlcj6aya9esc7a|j6w193g|jxalpdlp|kgbechtv|kprw13d|kpry57d|lgbbat1ad8j|mgbaam7a8h|mgbayh7gpa|mgbbh1a71e|mgbc0a9azcg|mgberp4a5d4ar|o3cw4h|ogbpf8fl|p1ai|pgbs0dh|s9brj9c|wgbh1c|wgbl6a|xkc2al3hye2a|xkc2dl3a5ee0h|yfro4i67o|ygbi2ammx|zckzah)|测试|परीक्षा|한국|ভারত|испытание|срб|테스트|சிங்கப்பூர்|טעסט|中国|中國|భారత్|ලංකා|測試|ભારત|भारत|آزمایشی|பரிட்சை|香港|δοκιμή|إختبار|台湾|台灣|الجزائر|امارات|الاردن|بھارت|المغرب|السعودية|ไทย|سورية|рф|تونس|ਭਾਰਤ|مصر|قطر|இலங்கை|இந்தியா|新加坡|فلسطين|テスト|y[et]|z[amw])/i, // See /lib/tld.js
domainPart = /[a-z0-9](?:[\-a-z0-9]*[a-z0-9])?/i,
port = /\d{1,5}/,
localpart = /[a-z0-9!#$%&'*+\/=?\^_`{|}~\-]+(?:\.[a-z0-9!#$%&'*+\/=?\^_`{|}~\-]+)*/i, // taken from: http://www.regular-expressions.info/email.html
user = /[^:@\/]+/i,
password = /[^:@\/]+?/i,
scheme = /(?:ftp|https?|tel|sms)/i,
path = /(?:\/[^ ]*)*/i;
fragments = {
tld: /(?:a[cdefgilmnoqrstuwxz]|aero|arpa|asia|b[abdefghijmnorstvwyz]|biz|c[acdfghiklmnoruvwxyz]|cat|com|coop|d[ejkmoz]|e[cegrstu]|edu|f[ijkmor]|g[abdefghilmnpqrstuwy]|gov|h[kmnrtu]|i[delmnoqrst]|info|int|j[emop]|jobs|k[eghimnprwyz]|l[abcikrstuvy]|m[acdeghklmnopqrstuvwxyz]|mil|mobi|museum|n[acefgilopruz]|name|net|om|org|p[aefghklmnrstwy]|pro|qa|r[eosuw]|s[abcdeghijklmnortuvxyz]|t[cdfghjklmnoprtvwz]|tel|travel|u[agksyz]|v[aceginu]|w[fs]|xxx|xn--(?:0zwm56d|11b5bs3a9aj6g|3e0b707e|45brj9c|80akhbyknj4f|90a3ac|9t4b11yi5a|clchc0ea0b2g2a9gcd|deba0ad|fiqs8s|fiqz9s|fpcrj9c3d|fzc2c9e2c|g6w251d|gecrj9c|h2brj9c|hgbk6aj7f53bba|hlcj6aya9esc7a|j6w193g|jxalpdlp|kgbechtv|kprw13d|kpry57d|lgbbat1ad8j|mgbaam7a8h|mgbayh7gpa|mgbbh1a71e|mgbc0a9azcg|mgberp4a5d4ar|o3cw4h|ogbpf8fl|p1ai|pgbs0dh|s9brj9c|wgbh1c|wgbl6a|xkc2al3hye2a|xkc2dl3a5ee0h|yfro4i67o|ygbi2ammx|zckzah)|测试|परीक्षा|한국|ভারত|испытание|срб|테스트|சிங்கப்பூர்|טעסט|中国|中國|భారత్|ලංකා|測試|ભારત|भारत|آزمایشی|பரிட்சை|香港|δοκιμή|إختبار|台湾|台灣|الجزائر|امارات|الاردن|بھارت|المغرب|السعودية|ไทย|سورية|рф|تونس|ਭਾਰਤ|مصر|قطر|இலங்கை|இந்தியா|新加坡|فلسطين|テスト|y[et]|z[amw])/i, // See /lib/tld.js
domainPart: /[a-z0-9](?:[\-a-z0-9]*[a-z0-9])?/i,
port: /\d{1,5}/,
localpart: /[a-z0-9!#$%&'*+\/=?\^_`{|}~\-]+(?:\.[a-z0-9!#$%&'*+\/=?\^_`{|}~\-]+)*/i, // taken from: http://www.regular-expressions.info/email.html
user: /[^:@\/]+/i,
password: /[^:@\/]+?/i,
scheme: /(?:ftp|https?|tel|sms)/i,
path: /(?:\/[^ ]*)*/i
};
install.domain = new RegExp(domainPart.source + "\\." + tld.source, "i");
install.subdomain = new RegExp("(?:" + domainPart.source + "\\.)*" + install.domain.source, "i");
install.email = new RegExp(localpart.source + "@" + install.subdomain.source, "i");
install.url = new RegExp(scheme.source + "://(?:" + user.source + "(?::" + password.source + ")?@)?" + install.subdomain.source + "(?::" + port.source + ")?(?:" + path.source + ")?", "i"); // See http://www.ietf.org/rfc/rfc1738.txt
install.mailto = new RegExp("mailto:" + install.email.source, "i"); // TODO: This needs to be improved
// Highlevel regexes composed of regex fragments
fragments.domain = new RegExp(fragments.domainPart.source + "\\." + fragments.tld.source, "i");
fragments.subdomain = new RegExp("(?:" + fragments.domainPart.source + "\\.)*" + fragments.domain.source, "i");
fragments.email = new RegExp(fragments.localpart.source + "@" + fragments.subdomain.source, "i");
fragments.url = new RegExp(fragments.scheme.source + "://(?:" + fragments.user.source + "(?::" + fragments.password.source + ")?@)?" + fragments.subdomain.source + "(?::" + fragments.port.source + ")?(?:" + fragments.path.source + ")?", "i"); // See http://www.ietf.org/rfc/rfc1738.txt
fragments.mailto = new RegExp("mailto:" + fragments.email.source, "i"); // TODO: This needs to be improved
/*jslint floop:true*/
for (name in install) {
if (install.hasOwnProperty(name)) {
(function (name) {
if (install[name].test) {
validation.regex[name] = new RegExp("^" + install[name].source + "$", "i");
validation[name] = function (value) {
return validation.regex[name].test(value);
};
} else {
validation[name] = install[name];
}
}(name));
// Add convenience regexes and functions
for (name in fragments) {
if (fragments.hasOwnProperty(name)) {
validation[name] = new RegExp("^" + fragments[name].source + "$", "i");
validation.functions[name] = function (value) {
return validation.regex[name].test(value);
};
}
}
/*jslint floop:false*/
// Expose regex fragments for matching inside larger texts
validation.fragments = fragments;
// Browser

@@ -45,0 +44,0 @@ if (typeof window !== 'undefined') {

@@ -1,1 +0,1 @@

(function(){var a={regex:{}},b={},c,d=/(?:a[cdefgilmnoqrstuwxz]|aero|arpa|asia|b[abdefghijmnorstvwyz]|biz|c[acdfghiklmnoruvwxyz]|cat|com|coop|d[ejkmoz]|e[cegrstu]|edu|f[ijkmor]|g[abdefghilmnpqrstuwy]|gov|h[kmnrtu]|i[delmnoqrst]|info|int|j[emop]|jobs|k[eghimnprwyz]|l[abcikrstuvy]|m[acdeghklmnopqrstuvwxyz]|mil|mobi|museum|n[acefgilopruz]|name|net|om|org|p[aefghklmnrstwy]|pro|qa|r[eosuw]|s[abcdeghijklmnortuvxyz]|t[cdfghjklmnoprtvwz]|tel|travel|u[agksyz]|v[aceginu]|w[fs]|xxx|xn--(?:0zwm56d|11b5bs3a9aj6g|3e0b707e|45brj9c|80akhbyknj4f|90a3ac|9t4b11yi5a|clchc0ea0b2g2a9gcd|deba0ad|fiqs8s|fiqz9s|fpcrj9c3d|fzc2c9e2c|g6w251d|gecrj9c|h2brj9c|hgbk6aj7f53bba|hlcj6aya9esc7a|j6w193g|jxalpdlp|kgbechtv|kprw13d|kpry57d|lgbbat1ad8j|mgbaam7a8h|mgbayh7gpa|mgbbh1a71e|mgbc0a9azcg|mgberp4a5d4ar|o3cw4h|ogbpf8fl|p1ai|pgbs0dh|s9brj9c|wgbh1c|wgbl6a|xkc2al3hye2a|xkc2dl3a5ee0h|yfro4i67o|ygbi2ammx|zckzah)|测试|परीक्षा|한국|ভারত|испытание|срб|테스트|சிங்கப்பூர்|טעסט|中国|中國|భారత్|ලංකා|測試|ભારત|भारत|آزمایشی|பரிட்சை|香港|δοκιμή|إختبار|台湾|台灣|الجزائر|امارات|الاردن|بھارت|المغرب|السعودية|ไทย|سورية|рф|تونس|ਭਾਰਤ|مصر|قطر|இலங்கை|இந்தியா|新加坡|فلسطين|テスト|y[et]|z[amw])/i,e=/[a-z0-9](?:[\-a-z0-9]*[a-z0-9])?/i,f=/\d{1,5}/,g=/[a-z0-9!#$%&'*+\/=?\^_`{|}~\-]+(?:\.[a-z0-9!#$%&'*+\/=?\^_`{|}~\-]+)*/i,h=/[^:@\/]+/i,i=/[^:@\/]+?/i,j=/(?:ftp|https?|tel|sms)/i,k=/(?:\/[^ ]*)*/i;b.domain=new RegExp(e.source+"\\."+d.source,"i"),b.subdomain=new RegExp("(?:"+e.source+"\\.)*"+b.domain.source,"i"),b.email=new RegExp(g.source+"@"+b.subdomain.source,"i"),b.url=new RegExp(j.source+"://(?:"+h.source+"(?::"+i.source+")?@)?"+b.subdomain.source+"(?::"+f.source+")?(?:"+k.source+")?","i"),b.mailto=new RegExp("mailto:"+b.email.source,"i");for(c in b)b.hasOwnProperty(c)&&function(c){b[c].test?(a.regex[c]=new RegExp("^"+b[c].source+"$","i"),a[c]=function(b){return a.regex[c].test(b)}):a[c]=b[c]}(c);typeof window!="undefined"&&(window.one=window.one||{},window.one.validation=a),typeof module!="undefined"&&(module.exports=a)})()
(function(){"use strict";var a,b={functions:{}},c={tld:/(?:a[cdefgilmnoqrstuwxz]|aero|arpa|asia|b[abdefghijmnorstvwyz]|biz|c[acdfghiklmnoruvwxyz]|cat|com|coop|d[ejkmoz]|e[cegrstu]|edu|f[ijkmor]|g[abdefghilmnpqrstuwy]|gov|h[kmnrtu]|i[delmnoqrst]|info|int|j[emop]|jobs|k[eghimnprwyz]|l[abcikrstuvy]|m[acdeghklmnopqrstuvwxyz]|mil|mobi|museum|n[acefgilopruz]|name|net|om|org|p[aefghklmnrstwy]|pro|qa|r[eosuw]|s[abcdeghijklmnortuvxyz]|t[cdfghjklmnoprtvwz]|tel|travel|u[agksyz]|v[aceginu]|w[fs]|xxx|xn--(?:0zwm56d|11b5bs3a9aj6g|3e0b707e|45brj9c|80akhbyknj4f|90a3ac|9t4b11yi5a|clchc0ea0b2g2a9gcd|deba0ad|fiqs8s|fiqz9s|fpcrj9c3d|fzc2c9e2c|g6w251d|gecrj9c|h2brj9c|hgbk6aj7f53bba|hlcj6aya9esc7a|j6w193g|jxalpdlp|kgbechtv|kprw13d|kpry57d|lgbbat1ad8j|mgbaam7a8h|mgbayh7gpa|mgbbh1a71e|mgbc0a9azcg|mgberp4a5d4ar|o3cw4h|ogbpf8fl|p1ai|pgbs0dh|s9brj9c|wgbh1c|wgbl6a|xkc2al3hye2a|xkc2dl3a5ee0h|yfro4i67o|ygbi2ammx|zckzah)|测试|परीक्षा|한국|ভারত|испытание|срб|테스트|சிங்கப்பூர்|טעסט|中国|中國|భారత్|ලංකා|測試|ભારત|भारत|آزمایشی|பரிட்சை|香港|δοκιμή|إختبار|台湾|台灣|الجزائر|امارات|الاردن|بھارت|المغرب|السعودية|ไทย|سورية|рф|تونس|ਭਾਰਤ|مصر|قطر|இலங்கை|இந்தியா|新加坡|فلسطين|テスト|y[et]|z[amw])/i,domainPart:/[a-z0-9](?:[\-a-z0-9]*[a-z0-9])?/i,port:/\d{1,5}/,localpart:/[a-z0-9!#$%&'*+\/=?\^_`{|}~\-]+(?:\.[a-z0-9!#$%&'*+\/=?\^_`{|}~\-]+)*/i,user:/[^:@\/]+/i,password:/[^:@\/]+?/i,scheme:/(?:ftp|https?|tel|sms)/i,path:/(?:\/[^ ]*)*/i};c.domain=new RegExp(c.domainPart.source+"\\."+c.tld.source,"i"),c.subdomain=new RegExp("(?:"+c.domainPart.source+"\\.)*"+c.domain.source,"i"),c.email=new RegExp(c.localpart.source+"@"+c.subdomain.source,"i"),c.url=new RegExp(c.scheme.source+"://(?:"+c.user.source+"(?::"+c.password.source+")?@)?"+c.subdomain.source+"(?::"+c.port.source+")?(?:"+c.path.source+")?","i"),c.mailto=new RegExp("mailto:"+c.email.source,"i");for(a in c)c.hasOwnProperty(a)&&(b[a]=new RegExp("^"+c[a].source+"$","i"),b.functions[a]=function(c){return b.regex[a].test(c)});b.fragments=c,typeof window!="undefined"&&(window.one=window.one||{},window.one.validation=b),typeof module!="undefined"&&(module.exports=b)})();

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc