I'd like to announce _assurance_, a library for input validation &
sanitization. It's been built with network APIs in mind, but it can be
used for CLI programs too.

## Features

  * Provides a **clean** & **pretty** API
  * Returns meaningful error **objects**, not error messages
  * **Accumulates** errors, doesn't bail straight away
  * Loves nested objects
  * Is general purpose - ish
  * Is resource conservative
  * Doesn't use schemas
  * Doesn't throw

Available in npm as `assurance`
Source on github: https://github.com/danmilon/assurance

Here's some of it's magicness:

    var assurance = require('assurance')

    var input = {
      name:    'Eve',
      hobbies: ['skating', 'coding', 666]
    }

    var assure = assurance(input)

    assure.me('name').is('string').len(3, 40)
    assure.me('hobbies', function (hobby) {
      hobby.is('string').len(3, 40)
    })

    console.log(assure.end())

    // [ { type: 'InvalidType',
    //     expected: 'string',
    //     is: 'number',
    //     message: 'value is of type number but string was expected',
    //     param: 'hobbies[2]' } ]

Hope you find it useful.
As always, issues & pull requests are more than welcome.

danmilon.

ps: Bonus cookie to whoever sends a PR for browser building

-- 
-- 
Job Board: http://jobs.nodejs.org/
Posting guidelines: 
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups "nodejs" group.
To post to this group, send email to nodejs@googlegroups.com
To unsubscribe from this group, send email to
nodejs+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en

--- 
You received this message because you are subscribed to the Google Groups 
"nodejs" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to nodejs+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to