Public
Edited
Feb 28
Paused
Importers
14 stars
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
asFacets = data => {
const root = {route: [], children: new Map()};
const add = (parent, key) => {
const entry = {
key: parent.key != null ? `${parent.key}__${key}` : key,
route: [...parent.route, key],
children: new Map()
};
parent.children.set(key, entry);
return entry;
};
const propMap = rollupProps(data, {
base: root,
path: (value, key, parent) => Array.isArray(value)
? parent
: parent.children.get(key) ?? add(parent, key)
});
const entries = [...propMap];

const proxy = values => {
const _values = [...values];
const filteredEntries = new Map(
entries
.map(([path, set]) => [path.key, _values.filter(d => set.has(d))])
.filter(d => d[1].length)
);
return new Proxy({}, {
ownKeys: () => [...filteredEntries.keys()],
get: (target, name) => proxy(filteredEntries.get(name)),
});
};

const byKey = new Map([...propMap].map(d => [d[0].key, d[1]]));
return new Proxy({}, {
ownKeys: () => [...byKey.keys()],
get: (target, name) => (byKey.get(name) ?? []),
});
}
Insert cell
expandInspect_doc = runExample(()=>
expandInspect(
inlineInspect({ foo: { bar: { baz: 123 } } }),
2 // max depth
), {name: "expandInspect", title: "Expand Inspector output", visibility})
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell

One platform to build and deploy the best data apps

Experiment and prototype by building visualizations in live JavaScript notebooks. Collaborate with your team and decide which concepts to build out.
Use Observable Framework to build data apps locally. Use data loaders to build in any language or library, including Python, SQL, and R.
Seamlessly deploy to Observable. Test before you ship, use automatic deploy-on-commit, and ensure your projects are always up-to-date.
Learn more