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