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

electrum-store

Package Overview
Dependencies
Maintainers
1
Versions
48
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

electrum-store - npm Package Compare versions

Comparing version 2.1.0 to 2.2.0

7

lib/store/store.js

@@ -201,4 +201,7 @@ 'use strict';

const value = obj[key];
this.select(id).set(key, value);
this.applyCollection(_state2.default.join(id, key), value, defaultKey);
if (key === defaultKey) {
this.select(id).set(key, value);
} else {
this.applyCollection(_state2.default.join(id, key), value, defaultKey);
}
});

@@ -205,0 +208,0 @@ } else {

{
"name": "electrum-store",
"version": "2.1.0",
"version": "2.2.0",
"description": "Electrum store provides a store implementation tailored for Electrum.",

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

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

it ('treats value named with default key as an entry value', () => {
const store = Store.create ();
const data = {a: {x: 'X'}, b: {value: 'Y'}};
store.applyCollection ('root', data, 'value'); // defaultKey is 'value'
expect (store.find ('root.a').get ('x')).to.be.undefined ();
expect (store.find ('root.a.x').get ('value')).to.equal ('X');
expect (store.find ('root.b').get ('value')).to.equal ('Y');
expect (store.find ('root.b.value')).to.not.exist ();
});
it ('accepts empty values', () => {

@@ -70,3 +82,19 @@ const store = Store.create ();

});
it ('example from README works', () => {
const store = Store.create ();
const array = [
{offset: 10, id: 'x', value: {year: 2016, name: 'foo'}}, // children year and name
{offset: 12, id: 'y', value: {year: 1984, name: 'bar'}}, // children year and name
{offset: 13, id: 'z', value: 'none'} // no children, plain value only
];
store.applyCollection ('root', array);
expect (store.select ('root.10.year').get ()).to.equal (2016);
expect (store.select ('root.12.name').get ()).to.equal ('bar');
expect (store.select ('root.10').get ('value')).to.deep.equal ({year: 2016, name: 'foo'});
expect (store.select ('root.13').get ('value')).to.equal ('none');
});
});
});

@@ -188,6 +188,9 @@ 'use strict';

const value = obj[key];
this
.select (id)
.set (key, value);
this.applyCollection (State.join (id, key), value, defaultKey);
if (key === defaultKey) {
this
.select (id)
.set (key, value);
} else {
this.applyCollection (State.join (id, key), value, defaultKey);
}
});

@@ -194,0 +197,0 @@ } else {

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