New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

joi-fp

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install
Package was removed
Sorry, it seems this package was removed from the registry

joi-fp

Provides a few wrappers around Joi's validate(), attempt() and assert() functions with their arguments re-ordered for easier currying / partial application

1.0.0
unpublished
Source
npm
Version published
Weekly downloads
0
Maintainers
1
Weekly downloads
 
Created
Source

#joi-fp

Provides a few wrappers around Joi's validate(), attempt() and assert() functions with their arguments re-ordered for easier currying / partial application

travis standard

Installation:

npm i joi-fp

Quick Example

const _ = require('lodash')
const joi = require('joi-fp')(require('joi'))

// example with currying
const validateInput = _.curry(joi.validateFp3)({
  name: joi.string().required()
})({allowUnknown: true});

validateInput({name: 'Max', color: 'blue'}) // { error: null, value: { name: 'Max', color: 'blue' } }

// example with partial application
const validateInputAgain = _.partial(joi.validateFp, {
  name: joi.string().required()
}, {allowUnknown: true});

validateInputAgain({name: 'Max', color: 'blue'}, (err, value) => {
  console.log(err, value) // null { name: 'Max', color: 'blue' }
})

Functions

// fixed arity for easy currying / partial application
validateFp2 (schema, value)
validateFp3 (schema, optsOrValue, optsOrCb)
validateFp (schema, options, value, callback)

attemptFp2 (schema, value)
attemptFp (schema, message, value)

assertFp2 (schema, message, value)
assertFp (schema, message, value)

Keywords

joi

FAQs

Package last updated on 14 Jan 2017

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