mirror of
https://github.com/bellingcat/datasheet-server.git
synced 2026-06-10 12:28:34 +03:00
23 lines
727 B
JavaScript
23 lines
727 B
JavaScript
import deeprows from './deeprows'
|
|
|
|
/**
|
|
* Each resource item is an object with values labelled according
|
|
* to column names specified in the sheet's first row. If two or more
|
|
* column names are the same except for a different integer at the end
|
|
* (e.g. 'tag1', and 'tag2'), then the values of those two columns are
|
|
* aggregated into a list, which is the value of the prefix's key ('tag').
|
|
* Any values in those columns that are empty will NOT be added to the list.
|
|
*
|
|
* @param {type} data list of lists representing sheet data.
|
|
* @return {type} Object the structured data.
|
|
*/
|
|
export default (data) => {
|
|
const output = {}
|
|
|
|
deeprows(data).forEach(row => {
|
|
output[row.id] = row
|
|
})
|
|
|
|
return output
|
|
}
|