@keymetrics/interdb
Advanced tools
Comparing version 0.0.3 to 0.0.4
@@ -39,5 +39,5 @@ 'use strict' | ||
fs.writeFile(this.path, JSON.stringify(this.db), err => { | ||
cb(err) | ||
if (typeof cb === 'function') return cb(err) | ||
}) | ||
this.clients.broadcast('command:updateDb', this.db) | ||
this.interdb.clients.broadcast('command:updateDb', this.db) | ||
} | ||
@@ -49,5 +49,5 @@ | ||
fs.writeFile(this.path, JSON.stringify(this.db), err => { | ||
cb(err) | ||
if (typeof cb === 'function') return cb(err) | ||
}) | ||
this.clients.broadcast('command:updateDb', this.db) | ||
this.interdb.clients.broadcast('command:updateDb', this.db) | ||
} | ||
@@ -64,2 +64,11 @@ | ||
push (key, value, cb) { | ||
if (!Array.isArray(this.db.data[key])) return cb(new Error(`${key} is not an array`)) | ||
this.db.data[key].push(value) | ||
fs.writeFile(this.path, JSON.stringify(this.db), err => { | ||
if (typeof cb === 'function') return cb(err) | ||
}) | ||
} | ||
// Timestamp | ||
@@ -66,0 +75,0 @@ |
{ | ||
"name": "@keymetrics/interdb", | ||
"version": "0.0.3", | ||
"version": "0.0.4", | ||
"description": "Shared and discoverable database services", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -22,3 +22,4 @@ # InterDB | ||
// DB | ||
con.db.put('key', {}, cb) // put new data in existing key or create it | ||
con.db.put('key', 'value', cb) // put new data in existing key or create it | ||
con.db.push('key', 'value', cb) // push data in existing key if it's an array | ||
con.db.del('key', cb) // delete key | ||
@@ -25,0 +26,0 @@ con.db.get('key') // get value from key |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
54179
141
49