Skip to content
This repository has been archived by the owner on Nov 4, 2022. It is now read-only.

Latest commit

 

History

History
55 lines (39 loc) · 1.72 KB

API.md

File metadata and controls

55 lines (39 loc) · 1.72 KB

Constants

any : Symbol

A wildcard to match any value.

Functions

Interface(...expected)Object

Returns a type to check value against with the instanceof operator.

match(expected, values)Array.<*>

Ensures the given values match the expected interfaces.

any : Symbol

A wildcard to match any value.

Kind: global constant

Interface(...expected) ⇒ Object

Returns a type to check value against with the instanceof operator.

Kind: global function
Returns: Object - A type to verify value against with the instanceof operator.

Param Type Description
...expected * The value expected types.

match(expected, values) ⇒ Array.<*>

Ensures the given values match the expected interfaces.

Kind: global function
Returns: Array.<*> - The matched values or their default values.
Throws:

  • TypeError Whenever not enough values are given and no default values are available to complete.
  • TypeError Whenever a value does not match any of its interfaces and no default value is available.
Param Type Description
expected Array.<(*|Array.<*>)> An array-like of interfaces w/ optional default, to match the values against.
values Array.<*> An array-like of values to match.