Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- config = reduce(argv, (acc, val, key) => {
- if (key === '_') return acc;
- return Object.assign(acc, { [key]: val });
- }, config);
- function reduce(obj, callback, initalValue) {
- return Object.keys(obj).reduce((acc, key) => {
- return callback(acc, obj[key], key);
- }, initalValue);
- }
- reduce({ test: 12 }, (acc, val, key) => Object.assign(acc, { [key]: val }), { test: 122 });
Add Comment
Please, Sign In to add comment