Comparing version 0.0.9 to 0.0.10
56
index.js
@@ -5,3 +5,3 @@ //----------------------------------------------------- | ||
// Site: 666.io | ||
// Version: 0.00.009 | ||
// Version: 0.00.010 | ||
// | ||
@@ -487,5 +487,26 @@ //----------------------------------------------------- | ||
function wFuncStore(name, func, store) { | ||
if(func === null) delete store[name]; | ||
else if(typeof(func) == "function") store[name] = func; | ||
else return store[name]; | ||
if(name === null) | ||
return; | ||
switch(typeof(name)) { | ||
case "string": | ||
if(func === null) delete store[name]; | ||
else if(typeof(func) === "function") store[name] = func; | ||
break; | ||
case "object": | ||
for(var field in name) { | ||
if(!name.hasOwnProperty(field)) continue; | ||
func = name[field]; | ||
if(func === null) delete store[name]; | ||
else if(typeof(func) === "function") store[name] = func; | ||
} | ||
break; | ||
} | ||
return; | ||
} | ||
@@ -497,3 +518,3 @@ | ||
"global": function(v) { | ||
if(!typeof(global) == "object" || typeof(v) == "undefined" || typeof(global.$validate) != "undefined") | ||
if(!typeof(global) === "object" || typeof(v) === "undefined") | ||
return this; | ||
@@ -510,7 +531,13 @@ | ||
global.$sanitize = gSObj; | ||
global.$validate = gVObj; | ||
if(typeof(global.$sanitize) === "undefined") | ||
global.$sanitize = gSObj; | ||
if(typeof(global.$validate) === "undefined") | ||
global.$validate = gVObj; | ||
} else { | ||
delete global.$sanitize; | ||
delete global.$validate; | ||
if(global.$sanitize === gExport.sanitize) | ||
delete global.$sanitize; | ||
if(global.$validate === gExport.validate) | ||
delete global.$validate; | ||
} | ||
@@ -522,7 +549,9 @@ | ||
"type": function(name, func) { | ||
return wFuncStore(name, func, customTypesStore); | ||
wFuncStore(name, func, customTypesStore); | ||
return this; | ||
}, | ||
"rule": function(name, func) { | ||
return wFuncStore(name, func, customRulesStore); | ||
wFuncStore(name, func, customRulesStore); | ||
return this; | ||
}, | ||
@@ -681,6 +710,3 @@ | ||
if(typeof(module) == "object") { | ||
module.exports = $aigis; | ||
if(typeof(global) == "object") | ||
$aigis.global(true); | ||
module.exports = $aigis.global(true); | ||
} |
{ | ||
"name": "aigis", | ||
"version": "0.0.9", | ||
"version": "0.0.10", | ||
"description": "Simple and Powerful module for strict validation", | ||
@@ -38,4 +38,4 @@ | ||
"_id": "aigis@0.0.9", | ||
"_id": "aigis@0.0.10", | ||
"_from": "aigis@" | ||
} |
@@ -34,4 +34,4 @@ `npm install aigis -g` | ||
| global | Set `$sanitize, $validate` as Global Var (NodeJS) | (v [default: true]) | | ||
| type | Set/Get/Delete custom Type (Sanitize) | (name, [func]) ~ func(input, options) | | ||
| rule | Set/Get/Delete custom Rule (Validate) | (name, [func]) ~ func(input, options) | | ||
| type | Set/Delete custom Type (Sanitize) | (name (String/HashTable), [func]) ~ func(input, options) | | ||
| rule | Set/Delete custom Rule (Validate) | (name (String/HashTable), [func]) ~ func(input, options) | | ||
| | - || | ||
@@ -38,0 +38,0 @@ | sanitize | - | (schema (String/HashTable), data, [options]) | |
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
48026
886