Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

informa-db.js

Package Overview
Dependencies
Maintainers
2
Versions
31
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

informa-db.js - npm Package Compare versions

Comparing version 2.3.0-beta.1 to 2.3.0-beta.2

2

package.json
{
"name": "informa-db.js",
"version": "2.3.0-beta.1",
"version": "2.3.0-beta.2",
"description": "DataBases made easier",

@@ -5,0 +5,0 @@ "main": "server.js",

@@ -24,26 +24,2 @@ const fs = require('fs');

genProxy(data) {
return new Proxy(data, {
set: (obj, prop, val) => {
obj[prop] = val;
if (this.saveOnChange) {
this.update();
}
return true;
},
deleteProperty: (obj, prop) => {
delete obj[prop];
if (this.saveOnChange) {
this.update();
}
return true;
},
get: (obj, prop) => (
typeof obj[prop] === 'object' && obj[prop]
? this.genProxy(obj[prop])
: obj[prop]
),
});
}
/**

@@ -75,3 +51,3 @@ * async Updates the file/db from this.readOnlyValue

get value() {
return this.genProxy(this.readOnlyValue);
return DbUtils.genProxy(this.readOnlyValue, this.saveOnChange, this.update);
}

@@ -78,0 +54,0 @@ }

@@ -1,2 +0,2 @@

module.exports = {
export default {
setAllTo(db, setTo) {

@@ -6,2 +6,25 @@ Object.keys(db).forEach((k) => delete db[k]);

},
genProxy(data, saveOnChange, update) {
return new Proxy(data, {
set: (obj, prop, val) => {
obj[prop] = val;
if (saveOnChange) {
update();
}
return true;
},
deleteProperty: (obj, prop) => {
delete obj[prop];
if (saveOnChange) {
update();
}
return true;
},
get: (obj, prop) => (
typeof obj[prop] === 'object' && obj[prop]
? this.genProxy(obj[prop])
: obj[prop]
),
});
},
};
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc