This is a playground to test JavaScript. It runs a completely standard copy of Node.js on a virtual server created just for you. Every one of npm’s 300,000+ packages are pre-installed, so try it out:
/* start demo only */
// replace db.clone_config(); ~ for demo only
const fs = require('fs'),
config = require('tweekdb/config'),
cl = console.log;
//edit demo config file here
config.settings.verbose = false;
fs.writeFileSync('./tweekdb.json', JSON.stringify(config))
/* end demo only */
//db cache only playground
const { tweek, tweekdb } = require('tweekdb'),
db = tweek(new tweekdb());
// set db cache
db.cache({
key: 'val',
object: {
title: 'tweekdb'
},
collection: [{
user: 'bob'
}],
array: ['one',2,3,4,5,6,7,8]
});
cl(
db.val()
)
// do something ...
db.set('key', 'val2').val();
db.get('object').assign({'subtitle': 'add subtitle here'}).val();
db.get('collection').push({id: db.uuid(), user: 'jill'}).val();
db.get('collection').find({user: 'bob'}).assign({id: db.uuid()}).val();
//db.get('array').unshift(0).push(9).val()
cl(
//db.val()
db.get('array').head().capitalize().val()
)