Skip to content

Instantly share code, notes, and snippets.

@hoodwink73
Last active May 19, 2020 14:44
Show Gist options
  • Save hoodwink73/b28c19dfd56c9bbce95eebdf450df242 to your computer and use it in GitHub Desktop.
Save hoodwink73/b28c19dfd56c9bbce95eebdf450df242 to your computer and use it in GitHub Desktop.
Template to quickly parse CSV using Papaparse and quokka
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
}, {})
}
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