Socket
Socket
Sign inDemoInstall

pouchdb-collections

Package Overview
Dependencies
Maintainers
4
Versions
33
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

pouchdb-collections - npm Package Compare versions

Comparing version 6.0.7 to 6.1.0

27

lib/index.js

@@ -13,11 +13,11 @@ 'use strict';

function LazyMap() {
this.store = {};
this._store = {};
}
LazyMap.prototype.get = function (key) {
var mangled = mangle(key);
return this.store[mangled];
return this._store[mangled];
};
LazyMap.prototype.set = function (key, value) {
var mangled = mangle(key);
this.store[mangled] = value;
this._store[mangled] = value;
return true;

@@ -27,15 +27,15 @@ };

var mangled = mangle(key);
return mangled in this.store;
return mangled in this._store;
};
LazyMap.prototype.delete = function (key) {
var mangled = mangle(key);
var res = mangled in this.store;
delete this.store[mangled];
var res = mangled in this._store;
delete this._store[mangled];
return res;
};
LazyMap.prototype.forEach = function (cb) {
var keys = Object.keys(this.store);
var keys = Object.keys(this._store);
for (var i = 0, len = keys.length; i < len; i++) {
var key = keys[i];
var value = this.store[key];
var value = this._store[key];
key = unmangle(key);

@@ -45,5 +45,10 @@ cb(value, key);

};
Object.defineProperty(LazyMap.prototype, 'size', {
get: function () {
return Object.keys(this._store).length;
}
});
function LazySet(array) {
this.store = new LazyMap();
this._store = new LazyMap();

@@ -58,6 +63,6 @@ // init with an array

LazySet.prototype.add = function (key) {
return this.store.set(key, true);
return this._store.set(key, true);
};
LazySet.prototype.has = function (key) {
return this.store.has(key);
return this._store.has(key);
};

@@ -64,0 +69,0 @@

{
"name": "pouchdb-collections",
"version": "6.0.7",
"version": "6.1.0",
"description": "Map and Set shims for PouchDB",

@@ -5,0 +5,0 @@ "main": "./lib/index.js",

@@ -9,11 +9,11 @@ // based on https://github.com/montagejs/collections

function LazyMap() {
this.store = {};
this._store = {};
}
LazyMap.prototype.get = function (key) {
var mangled = mangle(key);
return this.store[mangled];
return this._store[mangled];
};
LazyMap.prototype.set = function (key, value) {
var mangled = mangle(key);
this.store[mangled] = value;
this._store[mangled] = value;
return true;

@@ -23,15 +23,15 @@ };

var mangled = mangle(key);
return mangled in this.store;
return mangled in this._store;
};
LazyMap.prototype.delete = function (key) {
var mangled = mangle(key);
var res = mangled in this.store;
delete this.store[mangled];
var res = mangled in this._store;
delete this._store[mangled];
return res;
};
LazyMap.prototype.forEach = function (cb) {
var keys = Object.keys(this.store);
var keys = Object.keys(this._store);
for (var i = 0, len = keys.length; i < len; i++) {
var key = keys[i];
var value = this.store[key];
var value = this._store[key];
key = unmangle(key);

@@ -41,5 +41,10 @@ cb(value, key);

};
Object.defineProperty(LazyMap.prototype, 'size', {
get: function () {
return Object.keys(this._store).length;
}
});
function LazySet(array) {
this.store = new LazyMap();
this._store = new LazyMap();

@@ -54,6 +59,6 @@ // init with an array

LazySet.prototype.add = function (key) {
return this.store.set(key, true);
return this._store.set(key, true);
};
LazySet.prototype.has = function (key) {
return this.store.has(key);
return this._store.has(key);
};

@@ -60,0 +65,0 @@

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