First commit

This commit is contained in:
Lewis Diamond
2020-07-12 22:47:21 -04:00
commit 37ebd9f824
18 changed files with 3277 additions and 0 deletions

20
src/stores/pricing.js Normal file
View File

@@ -0,0 +1,20 @@
const memoryBackend = require("./backend/pricing/memory.js");
const globalCache = {};
let globalInstance;
function global({ seed = {}, backend = memoryBackend } = {}) {
if (!globalInstance) {
Object.assign(globalCache, seed, { USD: 1 });
globalInstance = backend(globalCache);
}
return globalInstance;
}
function instance({ cache = {}, backend = memoryBackend } = {}) {
return backend(Object.assign(cache, { USD: 1 }));
}
module.exports = {
global,
instance,
};