crocks
Version:
A collection of well known Algebraic Datatypes for your utter enjoyment.
22 lines (17 loc) • 634 B
JavaScript
/** @license ISC License (c) copyright 2017 original and current authors */
/** @author Ian Hofmann-Hicks (evil) */
var curry = require('../core/curry')
var fl = require('../core/flNames')
var isExtend = require('../core/isExtend')
var isFunction = require('../core/isFunction')
// extend : Extend w => (w a -> b) -> w a -> w b
function extend(fn, m) {
if(!isFunction(fn)) {
throw new TypeError('extend: Function required for first argument')
}
if(!isExtend(m)) {
throw new TypeError('extend: Extend required for second argument')
}
return (m[fl.extend] || m.extend).call(m, fn)
}
module.exports = curry(extend)