Skip to main content Link Search Menu Expand Document (external link)

Validator Utilities

import { Validator } from "https://vimtaai.github.io/agent/lib/utils.js"
Validator.validateNumber(5);
// -- OR --
import { validateNumber } from "https://vimtaai.github.io/agent/lib/utils.js";
validateNumber(5);

Functions

validateNumber(value: any)

Validates if the given value is a number, throws an error if it is not

validatePositiveNumber(value: any)

Validates if the given value is a positive number, throws an error if it is not

validateArray(value: any)

Validates if the given value is an array, throws an error if it is not

validateFunction(value: any)

Validates if the given value is a function, throws an error if it is not

validateColor(value: any)

Validates if the given value is a valid CSS color, throws an error if it is not

validateModel(value: any)

Validates if the given value is a Model, throws an error if it is not

validateAgent(value: any)

Validates if the given value is an Agent, throws an error if it is not

validateField(value: any)

Validates if the given value is a Field, throws an error if it is not

validateEntity(value: any)

Validates if the given value is an Entity (Agent or Field), throws an error if it is not

validateShape(value: any)

Validates if the given value is a Shape, throws an error if it is not