Socket
Socket
Sign inDemoInstall

aigis

Package Overview
Dependencies
Maintainers
1
Versions
26
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

aigis - npm Package Compare versions

Comparing version 0.0.11 to 0.0.12

28

index.js

@@ -5,3 +5,3 @@ //-----------------------------------------------------

// Site: 666.io
// Version: 0.00.011
// Version: 0.00.012
//

@@ -104,3 +104,3 @@ //-----------------------------------------------------

case "json":
return typeof(input) === "object";
return input === null || typeof(input) === "object";

@@ -383,2 +383,7 @@ //-----------------------]>

if(typeof(options.enum) !== "undefined")
return options.enum.indexOf(input) === -1 ? "" : input;
//------------]>
if(options.trim)

@@ -397,2 +402,5 @@ input = input.trim();

if(options.trim)
input = input.trim();
if(options.uppercase)

@@ -419,8 +427,10 @@ input = input.toUpperCase();

if(typeof(options.enum) !== "undefined")
return options.enum.indexOf(input) === -1 ? NaN : input;
//------------]>
if(options.abs)
input = Math.abs(input);
if(typeof(options.enum) !== "undefined" && options.enum.indexOf(input) === -1)
return NaN;
if(typeof(options.min) !== "undefined" && input < options.min)

@@ -442,8 +452,10 @@ return parseInt(options.min, 10);

if(typeof(options.enum) !== "undefined")
return options.enum.indexOf(input) === -1 ? NaN : input;
//------------]>
if(options.abs)
input = Math.abs(input);
if(typeof(options.enum) !== "undefined" && options.enum.indexOf(input) === -1)
return NaN;
if(typeof(options.min) !== "undefined" && input < options.min)

@@ -450,0 +462,0 @@ return parseFloat(options.min);

{
"name": "aigis",
"version": "0.0.11",
"version": "0.0.12",
"description": "Simple and Powerful module for strict validation",

@@ -38,4 +38,4 @@

"_id": "aigis@0.0.11",
"_id": "aigis@0.0.12",
"_from": "aigis@"
}

@@ -8,10 +8,10 @@ `npm install aigis -g`

var schema = {
"name": {"type": "string", "rule": "required", "max": 2, "trim": true},
"name": {"type": "string", "rule": "required", "max": 3, "trim": true},
"status": "?string",
"pts": {"use": "integer", "max": 30, "abs": true}
},
data = {"name": " XX+ ", "pts": "-60", "delThisField": "data"};
data = {"name": " XX + ", "pts": "-60", "delThisField": "data"};
$sanitize(schema, data);
$validate(schema, data);
$sanitize(schema, data); //_ { name: 'XX', pts: 30 }
$validate(schema, data); //_ false
```

@@ -28,3 +28,2 @@

#### Module

@@ -59,4 +58,11 @@

```
String:
default (stop chain) -> enum (stop chain) -> trim -> max -> only[Digits | Alphanumeric | Wordchar] -> trim -> [uppercase | lowercase] -> escape
Number:
default (stop chain) -> enum (stop chain)-> abs -> min -> max
```
#### Validate

@@ -153,3 +159,5 @@

"T1": $sanitize("integer", "80", {"max": 50}),
"T2": $sanitize("array", "[1,2,3]", {"max": 2})
"T2": $sanitize("array", "[1,2,3]", {"max": 2}),
"T3": $sanitize("integer", "50.5", {"enum": [10, 50]}),
"T4": $sanitize("integer", "60.5", {"enum": [10, 50]})
}, null, "\t"));

@@ -156,0 +164,0 @@

@@ -35,3 +35,5 @@ //-----------------------------------------------------

"T1": $sanitize("integer", "80", {"max": 50}),
"T2": $sanitize("array", "[1,2,3]", {"max": 2})
"T2": $sanitize("array", "[1,2,3]", {"max": 2}),
"T3": $sanitize("integer", "50.5", {"enum": [10, 50]}),
"T4": $sanitize("integer", "60.5", {"enum": [10, 50]})
}, null, "\t"));

@@ -46,7 +48,7 @@

var schema = {
"name": {"type": "string", "rule": "required", "max": 2, "trim": true},
"name": {"type": "string", "rule": "required", "max": 3, "trim": true},
"status": "?string",
"pts": {"use": "integer", "max": 30, "abs": true}
},
data = {"name": " XX+ ", "pts": "-60", "delThisField": "data"};
data = {"name": " XX + ", "pts": "-60", "delThisField": "data"};

@@ -53,0 +55,0 @@ console.log("0#", $sanitize(schema, data));

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