Skip to content

Instantly share code, notes, and snippets.

@muka
Created Jan 22, 2020
Embed
What would you like to do?
extract a list of people from a b2match API call
const baseUrl = "https://aal-programme-info-day-2020.b2match.io/participants"
const data = require("./data.json")
const participantRow = (participant) => {
let {
id,
user,
organisation_name,
organisation_type,
country,
business_fields,
website,
job_description,
} = participant
organisation_type = organisation_type || {name: ''}
// country org person role
// link F2F email biz card open calls lead pilot type expertise follow up date
const row = [
country.iso,
organisation_name,
`${user.first_name} ${user.last_name}`,
job_description,
`${baseUrl}/${user.id}`,
"", // email
"", // biz
"", // open calls
"", // lead
organisation_type.name,
business_fields.map(b => b.name).join(", "), // expertise
"",
"",
]
return row.join(";")
}
const {participants} = data
// console.log(participants[3]);
console.log(participants.map(participantRow).join("\n"))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment