UNPKG

crocks

Version:

A collection of well known Algebraic Datatypes for your utter enjoyment.

24 lines (18 loc) 547 B
/** @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') function either(lf, rf, m) { if(!(isFunction(lf) && isFunction(rf))) { throw new TypeError( 'either: First two arguments must be functions' ) } if(!(m && isFunction(m.either))) { throw new TypeError( 'either: Last argument must be a Sum Type' ) } return m.either(lf, rf) } module.exports = curry(either)