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

marsdb

Package Overview
Dependencies
Maintainers
1
Versions
66
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

marsdb - npm Package Compare versions

Comparing version 0.4.1 to 0.4.2

9

dist/Cursor.js

@@ -48,2 +48,6 @@ 'use strict';

var _EJSON = require('./EJSON');
var _EJSON2 = _interopRequireDefault(_EJSON);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

@@ -305,3 +309,6 @@

this._executing = this._matchObjects().then(function (docs) {
return _this3.processPipeline(docs);
var clonned = (0, _map3.default)(docs, function (doc) {
return _EJSON2.default.clone(doc);
});
return _this3.processPipeline(clonned);
}).then(function (docs) {

@@ -308,0 +315,0 @@ _this3._executing = null;

20

dist/StorageManager.js

@@ -10,6 +10,2 @@ 'use strict';

var _keys2 = require('fast.js/object/keys');
var _keys3 = _interopRequireDefault(_keys2);
var _forEach = require('fast.js/forEach');

@@ -75,3 +71,3 @@

return this._loadedPromise.then(function () {
return this.loaded().then(function () {
_this2._storage = {};

@@ -85,3 +81,3 @@ });

return this._loadedPromise.then(function () {
return this.loaded().then(function () {
_this3._storage[key] = _EJSON2.default.clone(value);

@@ -95,3 +91,3 @@ });

return this._loadedPromise.then(function () {
return this.loaded().then(function () {
delete _this4._storage[key];

@@ -105,4 +101,4 @@ });

return this._loadedPromise.then(function () {
return _EJSON2.default.clone(_this5._storage[key]);
return this.loaded().then(function () {
return _this5._storage[key];
});

@@ -116,5 +112,5 @@ }

var emitter = new _eventemitter2.default();
this._loadedPromise.then(function () {
(0, _forEach2.default)((0, _keys3.default)(_this6._storage), function (k) {
emitter.emit('data', { value: _EJSON2.default.clone(_this6._storage[k]) });
this.loaded().then(function () {
(0, _forEach2.default)(_this6._storage, function (v, k) {
emitter.emit('data', { value: v });
});

@@ -121,0 +117,0 @@ emitter.emit('end');

@@ -10,2 +10,3 @@ import _each from 'fast.js/forEach';

import DocumentSorter from './DocumentSorter';
import EJSON from './EJSON';

@@ -277,5 +278,8 @@

exec() {
this._executing = this._matchObjects().then((docs) => {
return this.processPipeline(docs);
}).then((docs) => {
this._executing = this._matchObjects()
.then(docs => {
const clonned = _map(docs, doc => EJSON.clone(doc));
return this.processPipeline(clonned);
})
.then(docs => {
this._executing = null;

@@ -282,0 +286,0 @@ return docs;

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

import _keys from 'fast.js/object/keys';
import _each from 'fast.js/forEach';

@@ -37,3 +36,3 @@ import EventEmitter from 'eventemitter3';

destroy() {
return this._loadedPromise.then(() => {
return this.loaded().then(() => {
this._storage = {};

@@ -44,3 +43,3 @@ });

persist(key, value) {
return this._loadedPromise.then(() => {
return this.loaded().then(() => {
this._storage[key] = EJSON.clone(value);

@@ -51,3 +50,3 @@ });

delete(key) {
return this._loadedPromise.then(() => {
return this.loaded().then(() => {
delete this._storage[key];

@@ -58,5 +57,3 @@ });

get(key) {
return this._loadedPromise.then(() => {
return EJSON.clone(this._storage[key]);
});
return this.loaded().then(() => this._storage[key]);
}

@@ -66,5 +63,5 @@

const emitter = new EventEmitter();
this._loadedPromise.then(() => {
_each(_keys(this._storage), (k) => {
emitter.emit('data', {value: EJSON.clone(this._storage[k])});
this.loaded().then(() => {
_each(this._storage, (v, k) => {
emitter.emit('data', {value: v});
});

@@ -71,0 +68,0 @@ emitter.emit('end');

{
"name": "marsdb",
"version": "0.4.1",
"version": "0.4.2",
"author": {

@@ -5,0 +5,0 @@ "name": "Artem Artemev",

@@ -19,3 +19,3 @@ import StorageManager from '../../lib/StorageManager';

it('should clone object when getting', () => {
it('should NOT clone object when getting', () => {
const db = new StorageManager();

@@ -28,7 +28,7 @@ return db.persist('a', {_id: 'a', a: 1}).then(() => {

}).then(doc => {
doc.a.should.be.equal(1);
doc.a.should.be.equal(2);
});
});
it('should clone objects when streaming', (done) => {
it('should NOT clone objects when streaming', (done) => {
const db = new StorageManager();

@@ -41,3 +41,3 @@ db.persist('a', {_id: 'a', a: 1}).then(() => {

.on('data', (doc) => {
doc.value.a.should.be.equal(1);
doc.value.a.should.be.equal(2);
})

@@ -44,0 +44,0 @@ .on('end', () => {

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

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