Published
Edited
Jan 25, 2021
3 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
F = new AFileSystem({
foo: [7],
bar: {
baz: [88, 99, 128],
depth: Object.assign([], {
first: new AFile("first", "first"),
last: new AFile("last", "last")
}),
blob: {
utf8: [new AFile("utf8", new Blob([new TextEncoder().encode("cow")]))],
utf16: [
new AFile("utf16", new Blob([new Uint8Array(encodeString("pig"))]))
]
},
[FILE]: (fs, path, name, version, rest, tree) => {
if (version === -1) {
// Unversioned case.
return [new AFile(name, [fs, path, name, version, rest, tree])];
} else {
// Versioned case. Must create AT LEAST the requested version.
const files = [];
files[version] = new AFile(name, [fs, path, name, version, rest, tree]);
return files;
}
},
[DIRECTORY]: (fs, path, name, version, rest, tree) => ({
call: [new AFile(name, [fs, path, name, version, rest, tree])]
})
},
senate: meta(
[meta(FileAttachment("ROLL_SENATE_2020_292.json"), { revision: 'final' })],
{ chamber: 'senate' }
),
attachment: [
new AFile('stream', (file, type) =>
FileAttachment("ROLL_SENATE_2020_292.json")[type]()
)
],
stream: [
new AFile('stream', (file, type) =>
FileAttachment("ROLL_SENATE_2020_292.json").stream()
)
]
})
Insert cell
Insert cell
F.find('/bar/blob/utf8').text({ utf8: true })
Insert cell
Insert cell
F.find('/bar/blob/utf16').text()
Insert cell
F.find('/bar/blob/utf16').text({ utf8: false })
Insert cell
Insert cell
F.metadata('/senate')
Insert cell
[F.find('/bar/baz@earliest'), F.find('/bar/baz@latest')]
Insert cell
Insert cell
{
F.add('/cow', 888);
F.label('/cow@1', 'beef');
F.add('/cow', 9234);
return [F.find('/cow@beef'), F.find('/cow')];
}
Insert cell
Insert cell
{
F.add('/pig@pork', 899);
F.add('/pig', 999);
return [
F.find('/pig'),
F.add('/pig@1', null),
F.find('/pig'),
F.find('/pig@pork')
];
}
Insert cell
Insert cell
F.find('/attachment').json()
Insert cell
Insert cell
V = F.find('/stream').json({ utf8: true })
Insert cell
Insert cell
F.find('/bar/sand').json()
Insert cell
F.find('/bar/bell@foo').json()
Insert cell
F.find('/bar/dive/call').json()
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
regenerator = {
return async function* regenerator(obj) {
let p = Promise.resolve(obj);
obj.updateCount = 0;
while (true) {
p = new Promise((acc, rej) => {
obj.updated = acc;
obj.errored = rej;
});
yield obj;
await p;
obj.updateCount++;
}
};
}
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
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