rambdax
Version:
Extended version of Rambda - a lightweight, faster alternative to Ramda
15 lines (12 loc) • 312 B
JavaScript
import { map } from './map'
import { type } from './type'
export function produce(rules, input){
if (arguments.length === 1){
return _input => produce(rules, _input)
}
return map(singleRule =>
type(singleRule) === 'Object' ?
produce(singleRule, input) :
singleRule(input),
rules)
}