muxrpc validation
Validation library for muxrpc apis.
var valid = require('muxrpc-validation')
var manifest = {
usage: 'sync',
get: 'async',
add: 'async',
list: 'source'
}
var api = {
usage: valid.sync(usage, 'string|boolean'),
get: valid.async(get, 'string'),
add: valid.async(add, ['string'], ['string', 'object']),
list: valid.source(list, 'queryOpts?')
}
valid.set('queryOpts', function (v) {
if (v.reverse && typeof v.reverse != 'boolean')
return new TypeError('opts.reverse must be a bool')
})
function usage (cmd) {
}
function get (key, cb) {
}
function add (key, value, cb) {
if (typeof value == 'function') {
value = key
key = value.key
cb = value
}
}
function list (opts) {
opts = opts || {}
}