Published
Edited
May 19, 2022
Importers
1 star
Insert cell
Insert cell
Insert cell
Insert cell
beddify = (rawData) => {
return rawData.items.map((d) => {
const date = new Date(
Date.UTC(
d.timestamp.slice(0, 4),
d.timestamp.slice(4, 6) - 1,
d.timestamp.slice(6, 8),
d.timestamp.slice(8, 10)
)
);
return {
...d,
date
};
});
}
Insert cell
Insert cell
dateToString = (date) => date.toISOString().slice(0, 10).replace(/-/g, "")
Insert cell
// e.g.,
dateToString(new Date())
Insert cell
Insert cell
viewof wikiItem = SearchForm({
placeholder: "Iniza a scrivere...",
description: "Ricerca una pagina in it.wikipedia.org",
format: (d) => d.entry, // what you want to search and display
suggestion: async (text) => {
const res = await d3.json(
`https://it.wikipedia.org/w/api.php?action=opensearch&format=json&search=${text}&namespace=0&limit=10&origin=*`
);
return res[1].map((d, i) => ({
entry: d,
url: res[3][i],
name: res[3][i].split("/").at(-1)
}));
}
})
Insert cell
//e.g.,
wikiItem
Insert cell
Insert cell
import { SearchForm } from "@floatingpurr/input-autocomplete"
Insert cell

Purpose-built for displays of data

Observable is your go-to platform for exploring data and creating expressive data visualizations. Use reactive JavaScript notebooks for prototyping and a collaborative canvas for visual data exploration and dashboard creation.
Learn more