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.24 to 0.0.25

80

index.js

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

// Site: 666.io
// Version: 0.00.024
// Version: 0.00.025
//

@@ -121,3 +121,4 @@ //-----------------------------------------------------

"validate": function(schema, data, options) {
return runSchema(C_MODE_VALIDATE, schema, data, options, $validateString, $validateHashTable);
return arguments.length === 1 ?
createModel(schema, gExport.validate) : runSchema(C_MODE_VALIDATE, schema, data, options, $validateString, $validateHashTable);
}

@@ -369,7 +370,9 @@ };

case "boolean":
if(typeof(input) === "boolean")
return input;
switch(typeof(input)) {
case "boolean":
return input;
if(typeof(input) === "string")
return input === "true" || input === "on" || input === "yes" || input === "1";
case "string":
return input === "true" || input === "on" || input === "yes" || input === "1";
}

@@ -379,15 +382,16 @@ return input === 1;

case "string":
if(typeof(input) === "string")
return input;
if(input === null) return "";
if(input === null || typeof(input) === "undefined")
return "";
switch(typeof(input)) {
case "string":
return input;
if(typeof(input.toString) === "function")
return input.toString();
case "undefined":
return "";
if(typeof(input) === "object")
return Object.prototype.toString.call(input);
case "object":
return typeof(input.toString) === "function" ? input.toString() : Object.prototype.toString.call(input);
}
return input + "";
return typeof(input.toString) === "function" ? input.toString() : input + "";

@@ -520,7 +524,10 @@ case "integer":

input = input.trim();
else if(options.ltrim)
input = input.replace(/^[\s\uFEFF\xA0]+/g, "");
else if(options.rtrim)
input = input.replace(/[\s\uFEFF\xA0]+$/g, "");
else {
if(options.ltrim)
input = input.replace(/^[\s\uFEFF\xA0]+/g, "");
if(options.rtrim)
input = input.replace(/[\s\uFEFF\xA0]+$/g, "");
}
//------------]>

@@ -535,4 +542,6 @@

input = input.trim();
else if(options.rtrim)
input = input.replace(/[\s\uFEFF\xA0]+$/g, "");
else {
if(options.rtrim)
input = input.replace(/[\s\uFEFF\xA0]+$/g, "");
}

@@ -781,3 +790,3 @@ //------------]>

case "url":
return typeof(input) === "string" && !!input.match(/^(?!mailto:)(?:(?:https?|ftp|ssh|ws|gopher|news|telnet|ldap):\/\/)?(?:\S+(?::\S*)?@)?(?:(?:(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z\u00a1-\uffff0-9]+-?)*[a-z\u00a1-\uffff0-9]+)(?:\.(?:[a-z\u00a1-\uffff0-9]+-?)*[a-z\u00a1-\uffff0-9]+)*(?:\.(?:[a-z\u00a1-\uffff]{2,})))|localhost)(?::\d{2,5})?(?:\/[^\s]*)?$/i);
return typeof(input) === "string" && !!input.match(/^(?:(?:https?|ftp|ssh|ws|gopher|news|telnet|ldap):\/\/)?(?:\S+(?::\S*)?@)?(?:(?:(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z\u00a1-\uffff0-9]+-?)*[a-z\u00a1-\uffff0-9]+)(?:\.(?:[a-z\u00a1-\uffff0-9]+-?)*[a-z\u00a1-\uffff0-9]+)*(?:\.(?:[a-z\u00a1-\uffff]{2,})))|localhost)(?::\d{2,5})?(?:\/[^\s]*)?$/i);

@@ -828,6 +837,15 @@ case "mongoId":

var rgPhone = gVPhones[options.locale || "ru-RU"];
var locale = options.locale;
return rgPhone && rgPhone.test(input);
if(locale && Array.isArray(locale)) {
var result = false;
for(var i = 0, l = locale.length; !result || i < l; i++)
result = gVPhones[locale[i]].test(input);
return result;
}
return gVPhones[locale || "ru-RU"].test(input);
//-----------[UUID]-------------}>

@@ -843,4 +861,16 @@

return version ? $validate("uuid.v" + version, input) : gVUUIDs[0].test(input);
if(!version)
return gVUUIDs[0].test(input);
if(Array.isArray(version)) {
var result = false;
for(var i = 0, l = version.length; !result || i < l; i++)
result = validate("uuid.v" + version[i], input);
return result;
}
return $validate("uuid.v" + version, input);
case "uuid.v3":

@@ -847,0 +877,0 @@ return !!input && typeof(input) === "string" && gVUUIDs[3].test(input);

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

@@ -41,4 +41,4 @@

"_id": "aigis@0.0.24",
"_id": "aigis@0.0.25",
"_from": "aigis@"
}

@@ -9,3 +9,3 @@ `npm install aigis -g`

$typenize("hashTable").format("INFO | {video}: {views}", '{"video": "cats", "views": 100500}');
$typenize("hashTable").format("{video}: {views}", '{"video": "cats", "views": 100500}');
$typenize("string").format("Date: {}", new Date());

@@ -35,3 +35,4 @@ $sanitize("array").format("Array: {2}, {1}, {0}", "[11, 12, 13]", {"max": 2})

var tpzUser = $typenize(schUser),
snzUser = $sanitize(schUser);
snzUser = $sanitize(schUser),
vldUser = $validate(schUser);

@@ -46,2 +47,5 @@ var data = {"name": "DT", "score": 13.7, "someData": 9};

snzUser.format("My name: {name};\nMy score: {score};", data);
vldUser(data);
vldUser.format("vldUser: {}", data);
```

@@ -73,3 +77,3 @@

| sanitize | - | (schema (String/HashTable), [data], [options]) |
| validate | - | (schema (String/HashTable), data, [options]) |
| validate | - | (schema (String/HashTable), [data], [options]) |

@@ -76,0 +80,0 @@

@@ -19,3 +19,4 @@ //-----------------------------------------------------

var tpzUser = $typenize(schUser),
snzUser = $sanitize(schUser);
snzUser = $sanitize(schUser),
vldUser = $validate(schUser);

@@ -26,3 +27,3 @@ var data = {"name": "DT", "score": 13.7, "someData": 999};

console.log(
tpzUser(data)
tpzUser(data) //_ Rewrite
);

@@ -37,3 +38,3 @@ console.log(

console.log(
snzUser(data)
snzUser(data) //_ New object
);

@@ -48,5 +49,19 @@ console.log(

console.log(
$typenize("hashTable").format("INFO | {video}: {views}", '{"video": "cats", "views": 100500}')
data,
vldUser(data),
vldUser(tpzUser(data)),
vldUser(snzUser(data))
);
console.log(
vldUser.format("vldUser: {}", data)
);
console.log("\n");
console.log(
$typenize("hashTable").format("{video}: {views}", '{"video": "cats", "views": 100500}')
);
console.log(
$sanitize("array").format("Array: {2}, {1}, {0}", "[11, 12, 13]", {"max": 2})

@@ -53,0 +68,0 @@ );

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