SHARE
TWEET

Untitled

a guest Feb 17th, 2019 59 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. config = reduce(argv, (acc, val, key) => {
  2.   if (key === '_') return acc;
  3.   return Object.assign(acc, { [key]: val });
  4. }, config);
  5.  
  6. function reduce(obj, callback, initalValue) {
  7.   return Object.keys(obj).reduce((acc, key) => {
  8.     return callback(acc, obj[key], key);
  9.   }, initalValue);
  10. }
  11.  
  12. reduce({ test: 12 }, (acc, val, key) => Object.assign(acc, { [key]: val }), { test: 122 });
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top