SHARE
TWEET

Untitled

a guest Oct 13th, 2019 92 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Array.prototype.mash = function(callback) {
  2.     const addKeyValuePair = (acc, item) => {
  3.         const [key, value] = callback ? callback(item) : item
  4.         return {...acc, [key]: value}
  5.     }
  6.  
  7.     return this.reduce(addKeyValuePair, {})
  8. }
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