Advertisement
Guest User

Untitled

a guest
Jul 23rd, 2019
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.63 KB | None | 0 0
  1. var arr = [ [ 'cardType', 'iDEBIT' ],
  2. [ 'txnAmount', '17.64' ],
  3. [ 'txnId', '20181' ],
  4. [ 'txnType', 'Purchase' ],
  5. [ 'txnDate', '2015/08/13 21:50:04' ],
  6. [ 'respCode', '0' ],
  7. [ 'isoCode', '0' ],
  8. [ 'authCode', '' ],
  9. [ 'acquirerInvoice', '0' ],
  10. [ 'message', '' ],
  11. [ 'isComplete', 'true' ],
  12. [ 'isTimeout', 'false' ] ]
  13.  
  14. var obj = Object.assign(...arr.map(([key, val]) => ({[key]: val})))
  15.  
  16. console.log(obj)
  17.  
  18. /*
  19. acquirerInvoice: "0"
  20. authCode: ""
  21. cardType: "iDEBIT"
  22. isComplete: "true"
  23. isTimeout: "false"
  24. isoCode: "0"
  25. message: ""
  26. respCode: "0"
  27. txnAmount: "17.64"
  28. txnDate: "2015/08/13 21:50:04"
  29. txnId: "20181"
  30. txnType: "Purchase"
  31. */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement