alexous-guard
v1.0.2
Published
A safe functions for type guard
Downloads
3
Readme
Alexous Guard
AlexousGuard
is a service that offers methods for validating objects and arrays of objects.
Installation
npm i alexous-guard
How use
import t from 'alexous-guard';
const model = {
name: "string",
age: "number",
};
const object = {
name: "John",
age: 25,
};
const isValid = t.guardModel({ model, object });
console.log(isValid); // Return 'true' or 'false'
Validating an array
const model = {
name: "string",
age: "number",
};
const array = [
{ name: "John", age: 25 },
{ name: "Doe", age: 30 },
];
const areValid = t.guardModelArray({ model, array });
console.log(areValid); // Return 'true' or 'false'