Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

muxrpc-validation

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

muxrpc-validation

Validation library for muxrpc apis

  • 1.0.3
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
13
decreased by-86.17%
Maintainers
1
Weekly downloads
 
Created
Source

muxrpc validation

Validation library for muxrpc apis.

var valid = require('muxrpc-validation')

var manifest = {
  usage: 'sync',
  get:   'async',
  add:   'async',
  list:  'source'
}

// wrap the functions in the validators
var api = {
  usage:   valid.sync(usage, 'string|boolean'), // multiple types
  get:     valid.async(get, 'string'),
  add:     valid.async(add, ['string'], ['string', 'object']), // multiple signatures
  list:    valid.source(list, 'queryOpts?') // optional param
}

// register special validators
valid.set('queryOpts', function (v) {
  if (v.reverse && typeof v.reverse != 'boolean')
    return new TypeError('opts.reverse must be a bool')
})

// function defs:
function usage (cmd) {
  // ...
}
function get (key, cb) {
  // ...
}
function add (key, value, cb) {
  if (typeof value == 'function') {
    // handle (value, cb)
    value = key
    key = value.key
    cb = value
  }
  // ...
}
function list (opts) {
  opts = opts || {}
  // ...
}

Keywords

FAQs

Package last updated on 15 Sep 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc