updeep-remeda/lib/withDefault.js

13 lines
273 B
JavaScript
Raw Normal View History

2017-04-19 00:55:46 +00:00
import update from './update'
import curry from './util/curry'
2015-08-01 15:13:25 +00:00
function withDefault(defaultValue, updates, object) {
if (typeof object === 'undefined') {
2017-04-19 00:55:46 +00:00
return update(updates, defaultValue)
}
2015-08-01 15:13:25 +00:00
2017-04-19 00:55:46 +00:00
return update(updates, object)
2015-08-01 15:13:25 +00:00
}
2017-04-19 00:55:46 +00:00
export default curry(withDefault)