UNPKG

jet-validators

Version:

Fast, zero-dependency TypeScript validators and utilities for runtime checks, parsing, and lightweight object schema validation.

75 lines (74 loc) 3.41 kB
import { SAFETY, } from './parseObjectCore.js'; import testObjectCore from './testObjectCore.js'; export function testObject(schema, onError) { return testObjectCore(false, false, false, schema, SAFETY.Normal, onError); } export function testOptionalObject(schema, onError) { return testObjectCore(true, false, false, schema, SAFETY.Normal, onError); } export function testNullableObject(schema, onError) { return testObjectCore(false, true, false, schema, SAFETY.Normal, onError); } export function testNullishObject(schema, onError) { return testObjectCore(true, true, false, schema, SAFETY.Normal, onError); } export function testObjectArray(schema, onError) { return testObjectCore(false, false, true, schema, SAFETY.Normal, onError); } export function testOptionalObjectArray(schema, onError) { return testObjectCore(true, false, true, schema, SAFETY.Normal, onError); } export function testNullableObjectArray(schema, onError) { return testObjectCore(false, true, true, schema, SAFETY.Normal, onError); } export function testNullishObjectArray(schema, onError) { return testObjectCore(true, true, true, schema, SAFETY.Normal, onError); } export function strictTestObject(schema, onError) { return testObjectCore(false, false, false, schema, SAFETY.Strict, onError); } export function strictTestOptionalObject(schema, onError) { return testObjectCore(true, false, false, schema, SAFETY.Strict, onError); } export function strictTestNullableObject(schema, onError) { return testObjectCore(false, true, false, schema, SAFETY.Strict, onError); } export function strictTestNullishObject(schema, onError) { return testObjectCore(true, true, false, schema, SAFETY.Strict, onError); } export function strictTestObjectArray(schema, onError) { return testObjectCore(false, false, true, schema, SAFETY.Strict, onError); } export function strictTestOptionalObjectArray(schema, onError) { return testObjectCore(true, false, true, schema, SAFETY.Strict, onError); } export function strictTestNullableObjectArray(schema, onError) { return testObjectCore(false, true, true, schema, SAFETY.Strict, onError); } export function strictTestNullishObjectArray(schema, onError) { return testObjectCore(true, true, true, schema, SAFETY.Strict, onError); } export function looseTestObject(schema, onError) { return testObjectCore(false, false, false, schema, SAFETY.Loose, onError); } export function looseTestOptionalObject(schema, onError) { return testObjectCore(true, false, false, schema, SAFETY.Loose, onError); } export function looseTestNullableObject(schema, onError) { return testObjectCore(false, true, false, schema, SAFETY.Loose, onError); } export function looseTestNullishObject(schema, onError) { return testObjectCore(true, true, false, schema, SAFETY.Loose, onError); } export function looseTestObjectArray(schema, onError) { return testObjectCore(false, false, true, schema, SAFETY.Loose, onError); } export function looseTestOptionalObjectArray(schema, onError) { return testObjectCore(true, false, true, schema, SAFETY.Loose, onError); } export function looseTestNullableObjectArray(schema, onError) { return testObjectCore(false, true, true, schema, SAFETY.Loose, onError); } export function looseTestNullishObjectArray(schema, onError) { return testObjectCore(true, true, true, schema, SAFETY.Loose, onError); }