SHARE
TWEET

Untitled

a guest Feb 14th, 2020 71 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. module.exports = ( () => {
  2.   return (arr, columns) => {
  3.     return arr.map((row) => {
  4.       let obj = {}
  5.       let i = 0
  6.       row.forEach(value => {
  7.         const chars = {'-': '_', '*': '_', ' ':'_'}
  8.         obj[columns[i].replace(/[-* ]/g, x => chars[x])] = value
  9.         i++
  10.       })
  11.       return obj
  12.     })
  13.   }
  14. })()
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