Published
Edited
Dec 5, 2020
1 fork
Insert cell
md`# Exporting data state to a browser extension
_… a jsonion project_`
Insert cell
module = new Object({
exports: {
__: { allowFunctions: true },
observablePlayground: observablePlayground, ...observablePlayground()
}
})
Insert cell
observablePlayground = () => { return {asd: "asdfaf"} }
Insert cell
jsonion_db = new Object({
i: {
trie: { type: { /* … list of types registered for validation */ } },
"{chr.0}": {
"{keyPath}": {},
"{keyPath}__{sortedBy}": {},
"{tableKey}": {},
"{tableKey}__{sortedBy}": {},
"{collectionKey}": {},
"{collectionKey}__{sortedBy}": {},
"{augmentationKey}": {},
"{augmentationKey}__{sortedBy}": {},
"{purposeKey}": {},
"{purposeKey}__{sortedBy}": {},
}},
_: { localStorage: { "jsonion.proxy": { "{tabIndex}": "{__diff}" }},
// … resolver functions
},
ctx: { // … mapping methods to a simplistic adapter
localStorage: {},
"svg#snow-menu": {}
},
ctxProxy: { // … api: {}, cache: {}, site: {}, stores: {},
components: {
}
}
})
Insert cell
{ // Library imports (kindy)
//
// Object.prototype.forEach = function(iterator){}
var d_b = new Object({
stem: () => {},
augment: () => {},
evaluateArgs: () => {},
schema: { mixin: () => {} }, // … renderProps: () => {},

trieKeys: function() {
var res = [], args = (!this.arguments) ? [] : this.argument
if( "undefined" == typeof jsonion_db.i.trie || !jsonion_db.i.trie.length )
return res = args.map( key => { return { [key]: null }} )
Object.entries(jsonion_db.i.trie).forEach((entry) => {
const [cat, key] = entry;
if( key in args )
res[key] = (typeof key.resolver !== 'undefined') ? key.resolver : null
else
(typeof key.resolver !== 'undefined')
? key.alias.forEach( alias => { (alias in args) ? res[key] = key.resolver : res[key] = null })
: res[key] = null
});
return res;
},
exprWrap: () => {},
toIndex: function(indexingKey, objects){},
indexParams: {/* Search query defaults to this */},
indexLoops: function(){},
indexCfg: new Object({
// … how one particular index object is composed (in a schematized object)
}),
sortIndexBy: (indexingKey, sortingKeys) => {},
shakeIndex: () => {},
unsetIndex: () => {},
loop: () => {},
trie: () => {},
parseSchemaObj: () => {},
hashIdQuake: () => {},
abbreviate: () => {}
})

// Namespace prefill
var { diff } = d_b.trieKeys("diff")

}
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