SHARE
TWEET

Untitled

a guest Jun 12th, 2019 58 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. export function frostTableToCommonLanguage ({columns, data, label}) {
  2.   if (data) {
  3.     const {headers, keys} = columns.reduce((tablePdf, element) => {
  4.       tablePdf.headers.push(element.label)
  5.       tablePdf.keys.push(element.propertyName)
  6.       return tablePdf
  7.     }, {headers: [], keys: []})
  8.     const body = data.map((element) => {
  9.       const tableValues = keys.map((key) => {
  10.         return get(element, key)
  11.       })
  12.       return tableValues
  13.     })
  14.     return {
  15.       label,
  16.       type: 'table',
  17.       data: {
  18.         headers,
  19.         body
  20.       }
  21.     }
  22.   }
  23. }
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