crocks
Version:
A collection of well known Algebraic Datatypes for your utter enjoyment.
18 lines (13 loc) • 367 B
JavaScript
/** @license ISC License (c) copyright 2017 original and current authors */
/** @author Ian Hofmann-Hicks (evil) */
var isFunction = require('../core/isFunction')
// unary : (* -> b) -> a -> b
function unary(fn) {
if(!isFunction(fn)) {
throw new TypeError('unary: Function required')
}
return function(x) {
return fn(x)
}
}
module.exports = unary