This package defines a utlity class for simple type-checking using a new Type
class.
Type
is constructed using one or more constructor functions (like String
) or strings (like 'string'
or 'number'
) for primitive types.
Type
also has two methods, compare and check, which act to test objects against the type information which is held by the Type
.
compare
accepts any object and returns an array containing booleans which represent whether or not the given object matches the held type information.
check
accepts any object and will throw an error if none of the held type information matches the given object.