Comparing version 0.0.7 to 0.0.8
16
index.js
@@ -5,3 +5,3 @@ //----------------------------------------------------- | ||
// Site: 666.io | ||
// Version: 0.00.007 | ||
// Version: 0.00.008 | ||
// | ||
@@ -464,2 +464,12 @@ //----------------------------------------------------- | ||
break; | ||
case "date": | ||
if(!input.getTime()) { | ||
if(typeof(options.default) !== "undefined") | ||
input = new Date(options.default); | ||
break; | ||
} | ||
break; | ||
} | ||
@@ -554,3 +564,3 @@ | ||
} else if(typeof(schemaData) === "object") { | ||
nameFunc = schemaData.use; | ||
nameFunc = schemaData.type || schemaData.use; | ||
} | ||
@@ -621,3 +631,3 @@ | ||
} else if(typeof(schemaData) === "object") { | ||
nameFunc = schemaData.use; | ||
nameFunc = schemaData.rule || schemaData.use; | ||
} | ||
@@ -624,0 +634,0 @@ |
{ | ||
"name": "aigis", | ||
"version": "0.0.7", | ||
"version": "0.0.8", | ||
"description": "Simple and Powerful module for strict validation", | ||
@@ -38,4 +38,4 @@ | ||
"_id": "aigis@0.0.7", | ||
"_id": "aigis@0.0.8", | ||
"_from": "aigis@" | ||
} |
@@ -8,3 +8,3 @@ `npm install aigis -g` | ||
var schema = { | ||
"name": {"use": "string", "max": 2, "trim": true}, | ||
"name": {"type": "string", "rule": "required", "max": 2, "trim": true}, | ||
"status": "?string", | ||
@@ -24,2 +24,3 @@ "pts": {"use": "integer", "max": 30, "abs": true} | ||
`?name` - Check an input only when the input exists (not undefined). | ||
`type` -> `use` <- `rule` | ||
@@ -45,2 +46,3 @@ #### Module | ||
| | - || | ||
| custom | - | - | | ||
| boolean | true: "true", "on", "yes", "1" | - | | ||
@@ -50,3 +52,3 @@ | string | - | default, max, trim, escape, lowercase, uppercase, onlyDigits, onlyAlphanumeric | | ||
| float | - | default, min, max, enum, abs | | ||
| date | - | - | | ||
| date | - | default | | ||
| hashTable | - | - | | ||
@@ -130,3 +132,3 @@ | array | - | max | | ||
console.log("+-------------------------+"); | ||
console.log("| V: Custom"); | ||
console.log("| S: Custom"); | ||
console.log("+-------------------------+"); | ||
@@ -133,0 +135,0 @@ |
@@ -43,10 +43,13 @@ //----------------------------------------------------- | ||
var schema = { | ||
"name": {"use": "string", "max": 2, "trim": true}, | ||
"name": {"type": "string", "rule": "required", "max": 2, "trim": true}, | ||
"status": "?string", | ||
"pts": {"use": "integer", "max": 30, "abs": true} | ||
}, | ||
data = {"name": " DT+ ", "pts": "-60", "delThisField": "data"}; | ||
data = {"name": " XX+ ", "pts": "-60", "delThisField": "data"}; | ||
console.log("0#", $sanitize(schema, data)); | ||
console.log("1#", $validate(schema, data)); | ||
console.log("2#", $validate(schema, $sanitize(schema, data))); | ||
@@ -53,0 +56,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
46717
858
222