Comparing version 6.2.1 to 6.3.0
@@ -13,22 +13,11 @@ "use strict"; | ||
}; | ||
const paymentMethods = Object.keys(paymentMethodsData); | ||
const schema = index_1.Abolish.compileObject({ | ||
keys: { | ||
typeof: "number", | ||
arraySize: paymentMethods.length, | ||
arrayValues: index_1.Abolish.compile({ inArray: paymentMethods }), | ||
$error: `Invalid payment method, Body Keys must be [${paymentMethods.join(", ")}]` | ||
}, | ||
values: { | ||
$name: "Body Values", | ||
array: "boolean" | ||
} | ||
const schema = index_1.Abolish.compile({ | ||
typeof: "object", | ||
objectValuesType: "boolean", | ||
objectValues: index_1.Abolish.compile("boolean") | ||
}); | ||
// console.dir(schema.data, { depth: null }); | ||
const b = abolish.validate({ | ||
keys: [], | ||
values: [] | ||
}, schema); | ||
console.log({ b }); | ||
const b = abolish.check(paymentMethodsData, schema); | ||
console.log(b); | ||
} | ||
Main().catch(console.error); |
{ | ||
"name": "abolish", | ||
"version": "6.2.1", | ||
"version": "6.3.0", | ||
"description": "A javascript object validator.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -12,2 +12,2 @@ import type Abolish from "./Abolish"; | ||
*/ | ||
export declare function registerValidators<T extends typeof Abolish>(abolish: T, validators: "string" | "array" | "utils"): typeof Abolish; | ||
export declare function registerValidators<T extends typeof Abolish>(abolish: T, validators: "string" | "array" | "utils" | "object"): typeof Abolish; |
@@ -9,4 +9,5 @@ "use strict"; | ||
function registerAllValidators(abolish) { | ||
registerValidators(abolish, "array"); | ||
registerValidators(abolish, "object"); | ||
registerValidators(abolish, "string"); | ||
registerValidators(abolish, "array"); | ||
registerValidators(abolish, "utils"); | ||
@@ -29,4 +30,6 @@ return abolish; | ||
return abolish.addGlobalValidators(require("../validators/utils")); | ||
case "object": | ||
return abolish.addGlobalValidators(require("../validators/object")); | ||
} | ||
} | ||
exports.registerValidators = registerValidators; |
@@ -10,2 +10,7 @@ // Arrays | ||
// Objects | ||
import "./object/objectValues"; | ||
import "./object/objectValuesAsync"; | ||
import "./object/objectValuesType"; | ||
// Strings | ||
@@ -12,0 +17,0 @@ import "./string/alphaNumeric"; |
217822
103
4190