Created
February 2, 2021 05:51
-
-
Save ismaelc/47c9ca41bea723b3a5a8a44df15c0eae to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Formats data into key:array | |
| function processData(arrayData) { | |
| let processed = {}; | |
| for (let [i, [text, label]] of arrayData.entries()) { | |
| // TODO: Deal with headers | |
| if (i == 0 && this.excludeFirstRow) continue; | |
| // Do not add empty rows | |
| if (text.trim() == '' || label.trim() == '') continue; | |
| if (label in processed) { | |
| processed[label].push(text); | |
| } else { | |
| processed[label] = [text]; | |
| } | |
| } | |
| return processed; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment