updeep-remeda/lib/ifElse.js
2017-04-18 17:55:46 -07:00

13 lines
330 B
JavaScript

import update from './update'
import wrap from './wrap'
function updateIfElse(predicate, trueUpdates, falseUpdates, object) {
const test = typeof predicate === 'function' ? predicate(object) : predicate
const updates = test ? trueUpdates : falseUpdates
return update(updates, object)
}
export default wrap(updateIfElse)