crocks
Version:
A collection of well known Algebraic Datatypes for your utter enjoyment.
20 lines (15 loc) • 517 B
JavaScript
/** @license ISC License (c) copyright 2017 original and current authors */
/** @author Ian Hofmann-Hicks (evil) */
var curry = require('../core/curry')
var isPredOrFunc = require('../core/isPredOrFunc')
var predOrFunc = require('../core/predOrFunc')
// not : (a -> Boolean) | Pred -> a -> Boolean
function not(pred, x) {
if(!isPredOrFunc(pred)) {
throw new TypeError(
'not: Pred or predicate function required for first argument'
)
}
return !predOrFunc(pred, x)
}
module.exports = curry(not)