First approach
d3 = require('d3')
d3.json("https://api.github.com/repos/rarmero/appwebcifolavioleta/contents", function(data)
{
console.log(data);
});
Second approach with map
contents = await d3.json("https://api.github.com/repos/rarmero/appwebcifolavioleta/contents")
names = contents.map(contents => {
const name = contents.name;
const url = contents.html_url;
return {name,url}
}
)
Inputs.table(names, { sort: "value", reverse: true })
Holidays
Select the country to know public holidays
viewof countrySelected = Inputs.select(["US", "ES"], {value: "ES"})
holidaysContent = await d3.json("https://date.nager.at/api/v2/publicholidays/2023/" +countrySelected)
holidays = holidaysContent.map(holidaysContent => {
const name = holidaysContent.name;
const date = holidaysContent.date;
return {name,date}
}
)
Inputs.table(holidays, { sort: "value", reverse: true })
lab delivery Code (MF01-0491)