Predicate checking if value is even.
Symbol used to express that a value did not satisfy a certain spec.
Predicate checking if value is a number.
Predicate checking if value is a function.
Predicate checking if value is a number.
Predicate checking if value is a number.
Predicate checking if value is a number.
Predicate checking if value is a symbol.
Predicate checking if value is negative.
Predicate checking if value is odd.
Predicate checking if value is positive.
Predicate checking if value is zero.
Adds a certain value to a certain key object's specs, initializing specs if necessary.
The object to be added to.
The key for the spec to be added to the object's spec (typically the spec's name).
Value representing if the object satisfied the keys.
Factory function for And
specs.
Name of the and spec. Important to set this to a human readable (meaningful) string, since this is what will get printed out in explain.
Specs that have all to be satisfied to fulfill this spec.
Returns an And
spec representing the conjunction of the given specs.
Asserts a spec on a given value. Returns the value if value passes specification,
returns perusal-immutable.invalid
otherwise.
The value to be asserted.
The spec to be used.
Returns the value if value passes specification, returns perusal-immutable.invalid otherwise.
Defines a new spec, allowing it to be referenced as such in the future.
The name that will be used to refer to the spec in the future.
The spec to be defined.
Factory function for Every
specs.
Name of the every spec. Important to set this to a human readable (meaningful) string, since this is what will get printed out in explain.
Specs that have all to be satisfied to fulfill this spec.
Returns an Every
spec representing that all elements in the collection have to
satisfy the provided spec..
Explains why a value passes/fails a specification.
The value to be checked.
The speficiation to be used.
Checks if a value is valid given a specificiation.
The value to be checked.
The speficiation to be used.
Returns boolean representing if the value if value passes spec.
Factory function for Keys
specs.
Name of the key spec. Important to set this to a human readable (meaningful) string, since this is what will get printed out in explain.
Specs that have all to be satisfied to fulfill this spec.
Returns a Keys
spec requiring the values of the input to satisfy
the keys initialized in this spec.
Factory function for OneOf
specs. Consider using the spread operator if you start with a
collection!
Name of the and spec. Important to set this to a human readable (meaningful) string, since this is what will get printed out in explain.
user-defined values used to assert future values.
Returns a OneOf
spec requiring the input value to be within one of the user
pre-defined values.
Factory function for Or
specs.
Name of the and spec. Important to set this to a human readable (meaningful) string, since this is what will get printed out in explain.
Specs, where one of them has to be satisfied to fulfill this spec.
Returns an Or
spec representing the disjunction of the given specs.
Factory function for Pred
specs. Note that this does not check if input function is a valid
boolean function (since program is unaware of user input domain), thus the responsibility is
on the user to verify that the input fn is a function. However, during runtime, should a
non-boolean output be detected, assert throws an error, which may help in debugging.
Name of the key spec. Important to set this to a human readable (meaningful) string, since this is what will get printed out in explain.
Predicate function that returns a boolean value on input within user-desired domain.
Returns a Pred
spec requiring the value to return true when fed
to fn
.
Generated using TypeDoc
{[key: string]: Spec} defs holds all user-made definitions.