Home Reference Source Test

References

summary
public

F unexpectedFiled(filed: *)

public

F AND(v1: *, v2: *)

public

F OR(v1: *, v2: *)

public

F arrayContainsAll(a: *, b: *): boolean

public

F flattenObject(ob: *): *

public

F isArray(arr: *)

public

F isFunction(func: *)

public

F isInt(val: *)

public

F isObject(obj: *)

public

F isString(str: *)

public

F looseEqual(a: any, b: any): boolean

Checks if two bojects are loosly equal

public

F mapFirstArgument(f: *, map: *): *

public

F mergeRule(rule1: *, rule2: *, mapFunction: *): {...rule1: Object, ...mappedCopy: Object, "type": *}

public

Regex that validates if a string is a valid url

Rule

summary
public
public

C Rule

The Rule class validates only one value once a rule is created it can be used multiple times

public

F getErrorFromFunctionOrString(error: *, path: *, value: *): *

public

F getErrorFromObject(error: *, path: *, value: *, key: *): *

Validator

summary
public
public

F getValFromPath(p: *, obj: *): *

public

F traverse(o: *, fn: *, p: *)

testFunctions

summary
public

F OPTIONAL(val: *, state: boolean)

The optional validation function

public

V TEST_FUNCTIONS: {...types: Object}

public

V BOOLEAN: {"type": *, "toBe": *}

This object combines all validation functions related to booleans

public

V NUMBER: {"min": *, "max": *, "equal": *, "type": *}

This object combines all validation functions related to numbers

public

V STRING: {"minLength": *, "maxLength": *, "equal": *, "match": *, "notEmpty": *, "type": *}

This object combines all validation functions related to strings

testFunctions/types

summary
public

V array: {"of": *, "notEmpty": *, "length": *, "type": *}

public

V boolean: {...BOOLEAN: Object}

public

V date: {"after": *, "before": *, "between": *, "equal": *, "type": *}

public

V email: {...STRING: Object, "type": *, "user": *, "domain": *}

public

V float: {...NUMBER: Object, "type": *}

public

V fn: {"type": *, "result": *}

public

V int: {...NUMBER: Object, "type": *}

public

V number: {...NUMBER: Object}

public

V password: {...STRING: Object, "numbers": *, "uppercase": *, "specialChars": *, "matchesOneOf": *, "matchesAllOf": *}

public

V string: {...STRING: Object}

public

V url: {...STRING: Object, "type": *, "domain": *, "protocol": *}