Roughing out the demo app
This commit is contained in:
25
node_modules/lowdb/lib/fp.js
generated
vendored
Normal file
25
node_modules/lowdb/lib/fp.js
generated
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
'use strict';
|
||||
|
||||
var flow = require('lodash/flow');
|
||||
var get = require('lodash/get');
|
||||
var set = require('lodash/set');
|
||||
var common = require('./common');
|
||||
|
||||
module.exports = function (adapter) {
|
||||
function db(path, defaultValue) {
|
||||
function getValue(funcs) {
|
||||
var result = get(db.getState(), path, defaultValue);
|
||||
return flow(funcs)(result);
|
||||
}
|
||||
|
||||
getValue.write = function () {
|
||||
var result = getValue.apply(undefined, arguments);
|
||||
set(db.getState(), path, result);
|
||||
return db.write();
|
||||
};
|
||||
|
||||
return getValue;
|
||||
}
|
||||
|
||||
return common.init(db, '__state__', adapter);
|
||||
};
|
||||
Reference in New Issue
Block a user