Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

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.22 to 0.0.23

67

index.js

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

// Site: 666.io
// Version: 0.00.022
// Version: 0.00.023
//

@@ -37,2 +37,14 @@ //-----------------------------------------------------

var gVUUIDs = {
0: /^[0-9A-F]{8}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{12}$/i,
3: /^[0-9A-F]{8}-[0-9A-F]{4}-3[0-9A-F]{3}-[0-9A-F]{4}-[0-9A-F]{12}$/i,
4: /^[0-9A-F]{8}-[0-9A-F]{4}-4[0-9A-F]{3}-[89AB][0-9A-F]{3}-[0-9A-F]{12}$/i,
5: /^[0-9A-F]{8}-[0-9A-F]{4}-5[0-9A-F]{3}-[89AB][0-9A-F]{3}-[0-9A-F]{12}$/i
};
var gVIPs = {
4: /^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/,
6: /^::|^::1|^([a-fA-F0-9]{1,4}::?){1,7}([a-fA-F0-9]{1,4})$/
};
//-----------------------------]>

@@ -379,6 +391,3 @@

case "integer":
if(input instanceof(Date)) {
if(typeof(input.valueOf) === "function")
input = input.valueOf(); else return NaN;
}
if(input === null) return NaN;

@@ -388,4 +397,7 @@ switch(typeof(input)) {

default:
if(input === null) return NaN;
case "object":
if(input instanceof(Date)) {
if(typeof(input.valueOf) === "function")
input = input.valueOf(); else return NaN;
}
}

@@ -396,6 +408,3 @@

case "float":
if(input instanceof(Date)) {
if(typeof(input.valueOf) === "function")
input = input.valueOf(); else return NaN;
}
if(input === null) return NaN;

@@ -406,4 +415,7 @@ switch(typeof(input)) {

default:
if(input === null) return NaN;
case "object":
if(input instanceof(Date)) {
if(typeof(input.valueOf) === "function")
input = input.valueOf(); else return NaN;
}
}

@@ -817,2 +829,4 @@

//-----------[UUID]-------------}>
case "uuid":

@@ -824,18 +838,17 @@ if(!input || typeof(input) !== "string")

var version = options.version,
pattern;
var version = options.version;
if(version == 3 || version == "v3")
pattern = /^[0-9A-F]{8}-[0-9A-F]{4}-3[0-9A-F]{3}-[0-9A-F]{4}-[0-9A-F]{12}$/i;
else if(version == 4 || version == "v4")
pattern = /^[0-9A-F]{8}-[0-9A-F]{4}-4[0-9A-F]{3}-[89AB][0-9A-F]{3}-[0-9A-F]{12}$/i;
else if(version == 5 || version == "v5")
pattern = /^[0-9A-F]{8}-[0-9A-F]{4}-5[0-9A-F]{3}-[89AB][0-9A-F]{3}-[0-9A-F]{12}$/i;
else
pattern = /^[0-9A-F]{8}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{12}$/i;
return version ? $validate("uuid.v" + version, input) : gVUUIDs[0].test(input);
return pattern.test(input);
case "uuid.v3":
return !!input && typeof(input) === "string" && gVUUIDs[3].test(input);
//------------------------]>
case "uuid.v4":
return !!input && typeof(input) === "string" && gVUUIDs[4].test(input);
case "uuid.v5":
return !!input && typeof(input) === "string" && gVUUIDs[5].test(input);
//-----------[IP]-------------}>
case "ip":

@@ -847,6 +860,6 @@ var version = options.version;

case "ip.v4":
return typeof(input) === "string" && (/^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/).test(input);
return !!input && typeof(input) === "string" && gVIPs[4].test(input);
case "ip.v6":
return typeof(input) === "string" && (/^::|^::1|^([a-fA-F0-9]{1,4}::?){1,7}([a-fA-F0-9]{1,4})$/).test(input);
return !!input && typeof(input) === "string" && gVIPs[6].test(input);

@@ -853,0 +866,0 @@ //------------------------]>

{
"name": "aigis",
"version": "0.0.22",
"version": "0.0.23",
"description": "Simple and Powerful module for strict data control",

@@ -40,4 +40,4 @@

"_id": "aigis@0.0.22",
"_id": "aigis@0.0.23",
"_from": "aigis@"
}

@@ -7,7 +7,16 @@ `npm install aigis -g`

$typenize({name: "string"}, {name: 13, "skipThisField": "data"});
$sanitize({name: {type: "string", max: 2}}, {name: "Omnomnomnus", "delThisField": "data"});
$typenize({name: "string"}, {name: 13, skipThisField: "data"});
$sanitize({name: {type: "string", max: 2}}, {name: "Omnomnus", delThisField: "data"});
$validate("integer", "2");
$sanitize("array", [6.9, "name", "delThisElem"], {"schema": ["integer", "string"]})
$sanitize("array", [6.9, "name", "delThisElem"], {schema: ["integer", "string"]});
$validate("?email", undefined);
$sanitize.type("testTypeDate", function(input, options) { return new Date(input); });
$validate.rule("testRuleMax10", function(input, options) { return options.k * input < 10; });
$typenize("testTypeDate", "---");
$sanitize("testTypeDate", "Thu, 01 Jan 1970 00:00:00 GMT-0400");
$validate("testRuleMax10", 50, {k: 2});
```

@@ -69,11 +78,11 @@

| | ALL (If `schema` is HashTable) | on |
| custom | - ||
| boolean | true: "true", "on", "yes", "1" ||
| string | - ||
| integer | - ||
| float | - ||
| date | - ||
| custom | - | - |
| boolean | true: "true", "on", "yes", "1" | - |
| string | - | - |
| integer | - | - |
| float | - | - |
| date | - | - |
| hashTable | - | schema |
| array | - | schema |
| json | - ||
| json | - | - |

@@ -143,3 +152,7 @@

| phone | `ru-RU`, `zh-CN`, `en-ZA`, `en-AU`, `en-HK`, `fr-FR`, `pt-PT`, `el-GR` | locale (def: "ru-RU") |
| | - ||
| uuid | - | version (def: 3,4,5) |
| uuid.v3 | - | - |
| uuid.v4 | - | - |
| uuid.v5 | - | - |
| | - ||

@@ -221,14 +234,2 @@ | ip | This function simply check whether the address is a valid IPv4 or IPv6 address | version (def: 4,6) |

console.log("+-------------------------+");
console.log("| S: Custom");
console.log("+-------------------------+");
$sanitize.type("testTypeDateEasy", function(input, options) {
return new Date(input);
});
console.log("0#", $sanitize("testTypeDateEasy", "Thu, 01 Jan 1970 00:00:00 GMT-0400"));
console.log("1#", $sanitize("testTypeDateEasy", "---"));
console.log("+-------------------------+");
console.log("| S: String");

@@ -262,26 +263,2 @@ console.log("+-------------------------+");

console.log("+-------------------------+");
console.log("| V: Custom");
console.log("+-------------------------+");
$validate.rule("testRuleMax10", function(input, options) {
return input < 10;
});
console.log("0#", $validate("testRuleMax10", 50));
console.log("1#", $validate("testRuleMax10", 8));
console.log("+-------------------------+");
console.log("| V: String");
console.log("+-------------------------+");
console.log(JSON.stringify({
"T0": $validate("string", 10),
"T1": $validate("integer", "10"),
"T2": $validate("email", "0d@root.pop"),
"T3": $validate("email", "0d-root.pop"),
"T4": $validate("?email", undefined)
}, null, "\t"));
console.log("+-------------------------+");
console.log("| V: HashTable");

@@ -288,0 +265,0 @@ console.log("+-------------------------+");

@@ -21,3 +21,3 @@ //-----------------------------------------------------

console.time("$typenize.string");
console.time("$typenize.string: number");

@@ -29,5 +29,22 @@ while(l--)

console.timeEnd("$typenize.string");
console.timeEnd("$typenize.string: number");
}
//---------------)>
{
var l = 1000 * 1000 * 1;
var data;
console.time("$typenize.string: undefined");
while(l--)
{
$typenize("float", data);
}
console.timeEnd("$typenize.string: undefined");
}
//------------------------------]>

@@ -40,3 +57,3 @@

console.time("parseFloat");
console.time("parseFloat: nubmer");

@@ -48,4 +65,22 @@ while(l--)

console.timeEnd("parseFloat");
console.timeEnd("parseFloat: nubmer");
}
//---------------)>
{
var l = 1000 * 1000 * 1;
var data;
console.time("parseFloat: undefined");
while(l--)
{
parseFloat(data);
}
console.timeEnd("parseFloat: undefined");
}
//------------------------------]>

@@ -58,6 +93,26 @@

var fXEnd = function (in2) { return parseFloat(in2); };
var fXEnd = function(in2) { return parseFloat(in2); };
var fXBegin = function(in1) { return fXEnd(in1); };
console.time("parseFloat + functions: nubmer");
while(l--)
{
fXBegin(data);
}
console.timeEnd("parseFloat + functions: nubmer");
}
//---------------)>
{
var l = 1000 * 1000 * 1;
var data = 1;
var fXEnd = function(in2) { return parseFloat(in2); };
var fXBegin = function(in1) { return fXEnd(); };
console.time("parseFloat + functions");
console.time("parseFloat + functions: undefined");

@@ -69,3 +124,3 @@ while(l--)

console.timeEnd("parseFloat + functions");
console.timeEnd("parseFloat + functions: undefined");
}

@@ -448,2 +448,5 @@ //-----------------------------------------------------

testV(false, "uuid", "550e8400-e29b-41d4-a716-446655440000x");
testV(false, "uuid.v3", "550e8400-e29b-41d4-a716-446655440000");
testV(true, "uuid.v4", "550e8400-e29b-41d4-a716-446655440000");
testV(false, "uuid.v5", "550e8400-e29b-41d4-a716-446655440000");

@@ -461,2 +464,5 @@

testV(false, "ip", "2001:xb8::7");
testV(true, "ip.v4", "100.005.055.88");
testV(false, "ip.v4", "3FFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF");
testV(true, "ip.v6", "3FFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF");

@@ -463,0 +469,0 @@ testV(false, "ascii", "");

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