Published
Edited
Sep 18, 2022
Importers
5 stars
Insert cell
Insert cell
Insert cell
md`
> For example, ${await link('@martien/abc')} does not exists, while ${await link('@martien/x-matrix')} does exist.
`
Insert cell
Insert cell
md`
> For example, ${linkDelayed('@martien/abc')} does not exists, while ${linkDelayed('@martien/x-matrix')} does exist.
`
Insert cell
Insert cell
async function exists(slug) {
return fetch(`https://api.observablehq.com/${slug}.js`, {method: 'HEAD'})
.then(r => r.ok).catch(() => false);
}
Insert cell
Insert cell
function linkDelayed(slug) {
const el = html`<a>${slug}`;
exists(slug).then(found => { if(found) el.href = `/${slug}` });
return el;
}
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