"use strict"; const { validateValue } = require("./"); const isString = require("@validatem/is-string"); const isBoolean = require("@validatem/is-boolean"); const isNumber = require("@validatem/is-number"); const required = require("@validatem/required"); const arrayOf = require("@validatem/array-of"); const anyProperty = require("@validatem/any-property"); let data = { one: "foo", two: "bar", array: [ "A", false, "C" ], mapping: { a: true, b: false, c: false, d: NaN } }; validateValue(data, { one: [ required, isString ], two: [ required, isNumber ], three: [ required, isBoolean ], optional: [ isString ], array: [ required, arrayOf([ required, isString ]) ], mapping: [ required, anyProperty({ key: [ required ], value: [ required, isBoolean ] }) ] }); /* AggregrateValidationError: One or more validation errors occurred: - At two: Must be a number - At three: Required value is missing - At array -> 1: Must be a string - At mapping -> d -> (value): Must be a boolean */