Comparing version 0.0.16 to 0.0.17
@@ -57,2 +57,5 @@ 'use strict' | ||
case 'isEmail': | ||
case 'isPinCode': | ||
case 'isPhone': | ||
case 'isHex': | ||
_match = _compare === validate.string[rule](value) | ||
@@ -59,0 +62,0 @@ break |
@@ -19,2 +19,23 @@ 'use strict' | ||
return (/^[\w\.-]+@[\w\.-]+$/i).test(value) | ||
}, | ||
isPinCode: function (value) { | ||
if (!value || !string.isString(value)) { | ||
return false | ||
} | ||
return (/^[\d]+$/).test(value) | ||
}, | ||
isPhone: function (value) { | ||
if (!value || !string.isString(value) || !string.isLonger(value, 2)) { | ||
return false | ||
} | ||
if ((/^\+?[\d .]+$/).test(value)) { | ||
return value.replace(/[+ .]/g, '').length > 2 | ||
} | ||
return false | ||
}, | ||
isHex: function (value) { | ||
if (!value || !string.isString(value)) { | ||
return false | ||
} | ||
return (/^[\da-f]+$/i).test(value) | ||
} | ||
@@ -21,0 +42,0 @@ } |
{ | ||
"name": "checkv", | ||
"version": "0.0.16", | ||
"version": "0.0.17", | ||
"description": "javascript idiomatic validator", | ||
@@ -5,0 +5,0 @@ "main": "main.js", |
@@ -37,2 +37,4 @@ # checkv | ||
checkv('simone@braceslab.com', { isEmail: true }) // return true | ||
checkv('+39 345 123 34 56', { isPhone: true }) // return true | ||
checkv('ff39aa345bc12b3e34d56d', { isHex: true }) // return true | ||
checkv('Frank', { isIn: ['Frank', 'Paul', 'Alex', 'Maurice'] }) // return true | ||
@@ -39,0 +41,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
46642
313
79