Comparing version 0.0.6 to 0.0.7
24
index.js
@@ -5,3 +5,3 @@ //----------------------------------------------------- | ||
// Site: 666.io | ||
// Version: 0.00.006 | ||
// Version: 0.00.007 | ||
// | ||
@@ -397,2 +397,18 @@ //----------------------------------------------------- | ||
if(options.onlyDigits) | ||
input = input.replace(/\D/g, ""); | ||
else if(options.onlyAlphanumeric) | ||
input = input.replace(/\W/g, ""); | ||
if(options.uppercase) | ||
input = input.toUpperCase(); | ||
else if(options.lowercase) | ||
input = input.toLowerCase(); | ||
if(options.escape) | ||
input = input | ||
.replace(/&/g, '&') | ||
.replace(/"/g, '"').replace(/'/g, ''') | ||
.replace(/</g, '<').replace(/>/g, '>'); | ||
break; | ||
@@ -408,2 +424,5 @@ | ||
if(options.abs) | ||
input = Math.abs(input); | ||
if(typeof(options.enum) !== "undefined" && options.enum.indexOf(input) === -1) | ||
@@ -428,2 +447,5 @@ return NaN; | ||
if(options.abs) | ||
input = Math.abs(input); | ||
if(typeof(options.enum) !== "undefined" && options.enum.indexOf(input) === -1) | ||
@@ -430,0 +452,0 @@ return NaN; |
{ | ||
"name": "aigis", | ||
"version": "0.0.6", | ||
"version": "0.0.7", | ||
"description": "Simple and Powerful module for strict validation", | ||
@@ -38,4 +38,4 @@ | ||
"_id": "aigis@0.0.6", | ||
"_id": "aigis@0.0.7", | ||
"_from": "aigis@" | ||
} |
@@ -10,5 +10,5 @@ `npm install aigis -g` | ||
"status": "?string", | ||
"pts": {"use": "integer", "max": 30} | ||
"pts": {"use": "integer", "max": 30, "abs": true} | ||
}, | ||
data = {"name": " XX+ ", "pts": "60", "delThisField": "data"}; | ||
data = {"name": " XX+ ", "pts": "-60", "delThisField": "data"}; | ||
@@ -31,3 +31,4 @@ $sanitize(schema, data); | ||
| global | Set `$sanitize, $validate` as Global Var (NodeJS) | (v [default: true]) | | ||
| rule | Add/Remove/Get custom Rule | (name, [func]) ~ func(input, options) | | ||
| type | Set/Get/Delete custom Type (Sanitize) | (name, [func]) ~ func(input, options) | | ||
| rule | Set/Get/Delete custom Rule (Validate) | (name, [func]) ~ func(input, options) | | ||
| | - || | ||
@@ -45,5 +46,5 @@ | sanitize | - | (schema (String/HashTable), data, [options]) | | ||
| boolean | true: "true", "on", "yes", "1" | - | | ||
| string | - | default, max, trim | | ||
| integer | - | default, min, max, enum | | ||
| float | - | default, min, max, enum | | ||
| string | - | default, max, trim, escape, lowercase, uppercase, onlyDigits, onlyAlphanumeric | | ||
| integer | - | default, min, max, enum, abs | | ||
| float | - | default, min, max, enum, abs | | ||
| date | - | - | | ||
@@ -78,27 +79,27 @@ | hashTable | - | - | | ||
| | - || | ||
| null | - | - | | ||
| nan | - | - | | ||
| finite | If number and not: NaN, INFINITY | - | | ||
| null | - | - | | ||
| nan | - | - | | ||
| finite | If number and not: NaN, INFINITY | - | | ||
| | - || | ||
| boolean | - | - | | ||
| string | - | min, max, enum, pattern | | ||
| integer | - | min, max, enum | | ||
| float | - | min, max, enum | | ||
| date | - | - | | ||
| hashTable | - | - | | ||
| array | - | min, max | | ||
| json | - | - | | ||
| boolean | - | - | | ||
| string | - | min, max, enum, pattern | | ||
| integer | - | min, max, enum | | ||
| float | - | min, max, enum | | ||
| date | - | - | | ||
| hashTable | - | - | | ||
| array | - | min, max | | ||
| json | - | - | | ||
| | - || | ||
| required | Not: null, undefined, length==0, NaN, Invalid Date | - | | ||
| notEmpty | If string not empty | - | | ||
| lowercase | If string is lowercase | - | | ||
| uppercase | If string is uppercase | - | | ||
| required | Not: null, undefined, length==0, NaN, Invalid Date | - | | ||
| notEmpty | If string not empty | - | | ||
| lowercase | If string is lowercase | - | | ||
| uppercase | If string is uppercase | - | | ||
| | - || | ||
| alphanumeric | Only letters and numbers | - | | ||
| alpha | Only letters | - | | ||
| numeric | Only numbers | - | | ||
| hexadecimal | - | - | | ||
| email | - | - | | ||
| url | Mailto, http, https, ftp, ssh, ws, gopher, news, telnet, ldap | - | | ||
| mongoId | - | - | | ||
| alphanumeric | If string is only letters and numbers | - | | ||
| alpha | If string is only letters | - | | ||
| numeric | If string is only numbers | - | | ||
| hexadecimal | - | - | | ||
| email | - | - | | ||
| url | Mailto, http, https, ftp, ssh, ws, gopher, news, telnet, ldap | - | | ||
| mongoId | - | - | | ||
| | - || | ||
@@ -105,0 +106,0 @@ | hexColor | - | strict (def: false) | |
@@ -17,3 +17,3 @@ //----------------------------------------------------- | ||
console.log("+-------------------------+"); | ||
console.log("| V: Custom"); | ||
console.log("| S: Custom"); | ||
console.log("+-------------------------+"); | ||
@@ -47,5 +47,5 @@ | ||
"status": "?string", | ||
"pts": {"use": "integer", "max": 30} | ||
"pts": {"use": "integer", "max": 30, "abs": true} | ||
}, | ||
data = {"name": " DT+ ", "pts": "60", "delThisField": "data"}; | ||
data = {"name": " DT+ ", "pts": "-60", "delThisField": "data"}; | ||
@@ -52,0 +52,0 @@ console.log("0#", $sanitize(schema, data)); |
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
46193
849
220