@keymetrics/interdb
Advanced tools
Comparing version 0.0.4 to 0.0.5
@@ -63,5 +63,7 @@ 'use strict' | ||
push (key, value, cb) { | ||
if (!Array.isArray(this.db.data[key])) return cb(new Error(`${key} is not an array`)) | ||
if (this.db.data[key] && !Array.isArray(this.db.data[key])) return cb(new Error(`${key} is not an array`)) | ||
this.db.data[key].push(value) | ||
if (this.db.data[key]) this.db.data[key].push(value) | ||
else this.db.data[key] = [value] | ||
fs.writeFile(this.path, JSON.stringify(this.db), err => { | ||
@@ -68,0 +70,0 @@ if (typeof cb === 'function') return cb(err) |
{ | ||
"name": "@keymetrics/interdb", | ||
"version": "0.0.4", | ||
"version": "0.0.5", | ||
"description": "Shared and discoverable database services", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -23,3 +23,3 @@ # InterDB | ||
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.push('key', 'value', cb) // push data in existing key if it's an array or create an array with value in first index | ||
con.db.del('key', cb) // delete key | ||
@@ -26,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
54306
142