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 to 2.3.1

4

browser.js

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

import * as DbUtils from './utils.js'; // eslint-disable-line import/extensions
import DbUtils from './utils.js'; // eslint-disable-line import/extensions

@@ -77,2 +77,2 @@ if (!window) throw new Error('Running in the wrong environment (Did not find window)');

module.exports = { Db, DbUtils };
export default { Db, DbUtils };
{
"name": "informa-db.js",
"version": "2.3.0",
"version": "2.3.1",
"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