Class: PatternMatcher

PatternMatcher()

Entity used to ensure that provided value matches supplied pattern(s), throws error(s) otherwise.

Constructor

new PatternMatcher()

Source:

Methods

$anyOf(pattern, value, path)

Supplied value matches at least one of `pattern`'s patterns.
Parameters:
Name Type Description
pattern
value
path
Source:

$ensure(pattern, value, path)

Ensures that supplied value satisfies provided function.
Parameters:
Name Type Description
pattern
value
path
Source:

$instanceOf(pattern, value)

Supplied value is an instance of the pattern's specified constructor.
Parameters:
Name Type Description
pattern
value
Source:

$iterableOf(pattern, value, path)

Supplied value is an iterable each item of which matches `pattern`'s pattern.
Parameters:
Name Type Description
pattern
value
path
Source:

$mapOf(pattern, value, path)

Supplied value is a map in which keys and values match `pattern`'s patterns.
Parameters:
Name Type Description
pattern
value
path
Source:

$matchIterable(pattern, value, path)

Supplied value is an iterable that matches the pattern's iterable's patterns.
Parameters:
Name Type Description
pattern
value
path
Source:

$matchObject(pattern, value, path)

Supplied value is an object that matches pattern's object patterns.
Parameters:
Name Type Description
pattern
value
path
Source:

$matchType(pattern, value)

Supplied value matches pattern's type.
Parameters:
Name Type Description
pattern
value
Source:

$matchValue(pattern, value)

Supplied value matches pattern's value.
Parameters:
Name Type Description
pattern
value
Source:

$objOf(pattern, value, path)

Supplied value is an object with one key existing in `pattern` that matches the pattern under this key.
Parameters:
Name Type Description
pattern
value
path
Source:

check(pattern, value, pathnullable)

Ensures that provided value matches supplied pattern(s), throws an error otherwise.
Parameters:
Name Type Attributes Description
pattern
value
path Array <nullable>
Source: