function mapData()

in apps_script/util.js [45:63]


function mapData([headers, values], modifyEntry = () => {}) {
  const data = values
    .map((row) => {
      let obj = {};
      if (row.every((str) => !str)) {
        return {};
      }
      headers.forEach((header, index) => {
        obj[header] = row[index];
      });

      if (modifyEntry) {
        obj = modifyEntry(obj);
      }
      return obj;
    })
    .filter((obj) => !!obj && Object.keys(obj).length > 0);
  return data;
}