Skip to content

Instantly share code, notes, and snippets.

@muka
Created January 22, 2020 14:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save muka/954dbb0cd2a40bf71186efc92518eebe to your computer and use it in GitHub Desktop.
Save muka/954dbb0cd2a40bf71186efc92518eebe to your computer and use it in GitHub Desktop.
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