Unlisted
Edited
Sep 9, 2024
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
blocks = Array.from(code.matchAll(/define[(]{.*/g), (x) => {
const { id, inputs, outputs, mode } = x[0].match(
/id: "(?<id>[\w-]+)"(?:, mode: "(?<mode>\w+)")?(?:, inputs: (?<inputs>\[.*?\]))?(?:, outputs: (?<outputs>\[.*?\]))?/
)?.groups ?? { id: x[0] };
return {
id,
mode,
inputs: JSON.parse(inputs ?? "[]").filter(d => !["display", "view"].includes(d)),
display: JSON.parse(inputs ?? "[]").find(d => d === "display"),
view: JSON.parse(inputs ?? "[]").find(d => d === "view"),
outputs: JSON.parse(outputs ?? "[]")
};
})
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