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