updeep-remeda/lib/withDefault.js
2015-08-01 08:13:25 -07:00

12 lines
248 B
JavaScript

import update from './update';
export default function withDefault(defaultValue, updates) {
return (value) => {
if (typeof value === 'undefined') {
return update(updates, defaultValue);
}
return update(updates, value);
};
}