updeep-remeda/lib/withDefault.js

12 lines
248 B
JavaScript
Raw Normal View History

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