updeep-remeda/lib/withDefault.js

13 lines
287 B
JavaScript
Raw Normal View History

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