Comparing version 1.0.1 to 1.0.2
{ | ||
"name": "joi-fp", | ||
"version": "1.0.1", | ||
"version": "1.0.2", | ||
"description": "Provides a few wrappers around Joi's validate(), attempt() and assert() functions with their arguments re-ordered for easier currying / partial application", | ||
@@ -5,0 +5,0 @@ "main": "./lib/index.js", |
@@ -8,5 +8,8 @@ #joi-fp | ||
[![standard][standard-image]][standard-url] | ||
[![npm][npm-image]][npm-url] | ||
[travis-image]: https://travis-ci.org/maxnachlinger/joi-fp.svg?branch=master | ||
[travis-url]: https://travis-ci.org/maxnachlinger/joi-fp | ||
[npm-image]: https://img.shields.io/npm/v/joi-fp.svg?style=flat | ||
[npm-url]: https://npmjs.org/package/joi-fp | ||
[standard-image]: https://img.shields.io/badge/code%20style-standard-brightgreen.svg | ||
@@ -20,2 +23,5 @@ [standard-url]: http://standardjs.com/ | ||
### What problem does this solve? | ||
When using functions like ``joi.validate()``, you will almost always have values for ``schema`` and/or ``options`` before you have the ``value`` being validated. This little library re-orders the arguments of ``joi.validate()``, ``joi.attempt()`` and ``joi.assert()`` allowing you to pass the data you have initially, well, initially :) This library also has a few versions of these functions with fixed arities to make currying and partial application easier. | ||
### Quick Example | ||
@@ -31,3 +37,4 @@ ```javascript | ||
validateInput({name: 'Max', color: 'blue'}) // { error: null, value: { name: 'Max', color: 'blue' } } | ||
validateInput({name: 'Max', color: 'blue'}) | ||
// { error: null, value: { name: 'Max', color: 'blue' } } | ||
@@ -34,0 +41,0 @@ // example with partial application |
4194
61
3
24