Last active
May 19, 2020 14:44
-
-
Save hoodwink73/b28c19dfd56c9bbce95eebdf450df242 to your computer and use it in GitHub Desktop.
Template to quickly parse CSV using Papaparse and quokka
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
function getGradedSumInsured (data) { | |
return data.reduce((result, member) => { | |
if (member["Relationship"] === "self") { | |
var si = member["Sum Insured"] | |
if (result[si]) { | |
result[si].push(member["Email"]) | |
} else { | |
result[si] = [member["Email"]] | |
} | |
} | |
return result | |
}, {}) | |
} |
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
import {parse} from 'papaparse'; | |
import clipboardy from 'clipboardy'; | |
var k = parse(` | |
`, { | |
header: true, | |
dynamicTyping: true, | |
skipEmptyLines: true, | |
}) | |
clipboardy.writeSync(JSON.stringify(k.data)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment