muxrpc validation
Validation library for muxrpc apis.
// create validator libraryvar valid = { if vreverse && typeof vreverse != 'boolean' return 'opts.reverse must be a bool' } // api manifestvar manifest = usage: 'sync' get: 'async' add: 'async' list: 'source' // api definition - wrap the functions in the validatorsvar api = usage: valid // multiple types get: valid add: valid // multiple signatures put: valid // async method works without a cb list: validsourcelist 'queryOpts?' // optional param { // ...} { // ...} { if typeof value == 'function' // handle (value, cb) value = key key = valuekey cb = value // ...} { opts = opts || {} // ...}