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

one-validation

Package Overview
Dependencies
Maintainers
2
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.2.3 to 0.2.4

test/url-test.js

18

package.json
{
"author": "Peter Müller <munter@fumle.dk> (http://fumle.dk)",
"maintainers": [
{
"name": "Peter Müller",
"email": "munter@fumle.dk"
},
{
"name": "Andreas Lind Petersen",
"email": "andreas@one.com"
}
],
"name": "one-validation",
"description": "Regexp based validation collection for common internet validation tasks",
"version": "0.2.3",
"version": "0.2.4",
"repository": {

@@ -15,8 +24,9 @@ "url": "git://github.com/One-com/one-validation.git"

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

@@ -34,5 +34,5 @@ /*global module, window*/

user: /[^:@\/]+/i,
uuid: /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/,
password: /[^:@\/]+?/i,
scheme: /(?:ftp|https?|tel|sms)/i,
pathname: /[\w%+@*\-\.\/\(\)]*/i,
pathname: /[\w%+@*\-\.\/\(\)]*/,
search: /[\w%+@*\-\.\/\(\)\?&=;]*/,

@@ -46,21 +46,29 @@ hash: /[\w%+@*\-\.\/\(\)\?#&=;]*/

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.pathname.source + "(?:" + fragments.search.source + ")?(?:" + fragments.hash.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
fragments.mailtoUrl = new RegExp("mailto:" + fragments.email.source, "i"); // TODO: This needs to be improved
fragments.url = new RegExp(concatRegExps(
fragments.scheme, "://",
"(?:",
fragments.user,
"(?::",
fragments.password,
")?@",
")?",
fragments.subdomain,
"(?::", fragments.port, ")?",
"(?:/", fragments.pathname,
"(?:\\?", fragments.search, ")?",
"(?:#", fragments.hash, ")?",
")?" // See http://www.ietf.org/rfc/rfc1738.txt
), "i");
function createHttpishUrlRegExp(schemeRegExp) {
// [protocol"://"[username[":"password]"@"]hostname[":"port]"/"?][path]["?"querystring]["#"fragment]
return new RegExp(concatRegExps(
schemeRegExp, "://",
"(?:",
fragments.user,
"(?::",
fragments.password,
")?@",
")?",
fragments.subdomain,
"(?::", fragments.port, ")?",
"(?:/", fragments.pathname,
"(?:\\?", fragments.search, ")?",
"(?:#", fragments.hash, ")?",
")?" // See http://www.ietf.org/rfc/rfc1738.txt
), "i");
}
fragments.httpUrl = createHttpishUrlRegExp(/https?/);
fragments.ftpUrl = createHttpishUrlRegExp(/ftp/);
// Alias 'httpUrl' as 'url' for backwards compatibility:
fragments.url = fragments.httpUrl;
// Add convenience regexes and functions

@@ -67,0 +75,0 @@ for (name in fragments) {

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

(function(){function a(){var a="";for(var b=0;b<arguments.length;b+=1)Object.prototype.toString.call(arguments[b])==="[object RegExp]"?a+=arguments[b].source:a+=arguments[b];return a}"use strict";var b,c={functions:{}},d={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,pathname:/[\w%+@*\-\.\/\(\)]*/i,search:/[\w%+@*\-\.\/\(\)\?&=;]*/,hash:/[\w%+@*\-\.\/\(\)\?#&=;]*/};d.domain=new RegExp(d.domainPart.source+"\\."+d.tld.source,"i"),d.subdomain=new RegExp("(?:"+d.domainPart.source+"\\.)*"+d.domain.source,"i"),d.email=new RegExp(d.localpart.source+"@"+d.subdomain.source,"i"),d.url=new RegExp(d.scheme.source+"://(?:"+d.user.source+"(?::"+d.password.source+")?@)?"+d.subdomain.source+"(?::"+d.port.source+")?(?:"+d.pathname.source+"(?:"+d.search.source+")?(?:"+d.hash.source+")?)?","i"),d.mailto=new RegExp("mailto:"+d.email.source,"i"),d.url=new RegExp(a(d.scheme,"://","(?:",d.user,"(?::",d.password,")?@",")?",d.subdomain,"(?::",d.port,")?","(?:/",d.pathname,"(?:\\?",d.search,")?","(?:#",d.hash,")?",")?"),"i");for(b in d)d.hasOwnProperty(b)&&(c[b]=new RegExp("^"+d[b].source+"$","i"),c.functions[b]=function(a){return function(b){return c[a].test(b)}}(b));c.fragments=d,typeof window!="undefined"&&(window.one=window.one||{},window.one.validation=c),typeof module!="undefined"&&(module.exports=c)})();
(function(){function a(){var a="";for(var b=0;b<arguments.length;b+=1)Object.prototype.toString.call(arguments[b])==="[object RegExp]"?a+=arguments[b].source:a+=arguments[b];return a}function e(b){return new RegExp(a(b,"://","(?:",d.user,"(?::",d.password,")?@",")?",d.subdomain,"(?::",d.port,")?","(?:/",d.pathname,"(?:\\?",d.search,")?","(?:#",d.hash,")?",")?"),"i")}"use strict";var b,c={functions:{}},d={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,uuid:/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/,password:/[^:@\/]+?/i,pathname:/[\w%+@*\-\.\/\(\)]*/,search:/[\w%+@*\-\.\/\(\)\?&=;]*/,hash:/[\w%+@*\-\.\/\(\)\?#&=;]*/};d.domain=new RegExp(d.domainPart.source+"\\."+d.tld.source,"i"),d.subdomain=new RegExp("(?:"+d.domainPart.source+"\\.)*"+d.domain.source,"i"),d.email=new RegExp(d.localpart.source+"@"+d.subdomain.source,"i"),d.mailtoUrl=new RegExp("mailto:"+d.email.source,"i"),d.httpUrl=e(/https?/),d.ftpUrl=e(/ftp/),d.url=d.httpUrl;for(b in d)d.hasOwnProperty(b)&&(c[b]=new RegExp("^"+d[b].source+"$","i"),c.functions[b]=function(a){return function(b){return c[a].test(b)}}(b));c.fragments=d,typeof window!="undefined"&&(window.one=window.one||{},window.one.validation=c),typeof module!="undefined"&&(module.exports=c)})();
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