-
Notifications
You must be signed in to change notification settings - Fork 0
API
Ankit Patel edited this page Aug 5, 2017
·
9 revisions
wip...
Create a validation object to check one or more identifiers with one or more regular expressions (literal/object form).
check(':year')(/^201[0-7]$/) // 2010 - 2017
check(':vehicle', ':color')(/.{3}/, /^[a-z]+$/) // at least 3 characters
Create a spec over one or more path keys and actions.
// show "vehicle" by "year" or "color"
spec('/:vehicle', '/:vehicle/:year', '/:vehicle/:color')(next, err, fail)
/**************
next: on exact match
/automobile or /motorcycle
/automobile/red or /automobile/2017
/motorcycle/blue or /motorcycle/2017
err: on partial match
/automobile/2020 or /motorcycle/z
fail: no match
/z
**************/