Published
Edited
Oct 9, 2022
Fork of Helpers
Importers
1 star
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
hi = template((s) => `hello, ${s}!`)
Insert cell
hi`world`
Insert cell
bubble = template(
(s) =>
html`<span style="border-radius: 0.75em; font-weight: bold; color: white; font-size: 0.8em; font-family: sans-serif; background: #66f; padding: 0.21em 0.4em">${s}</span>`
)
Insert cell
bubble`sparkles`
Insert cell
Insert cell
template = (f) =>
(strings, ...vals) => {
// took this template literal concatenator from https://observablehq.com/@shaunlebron/wasm#wasm
return f(strings.reduce((acc, str, i) => acc + vals[i - 1] + str));
}
Insert cell
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