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 1.8.0 to 1.9.0

5

lib/store/state.js

@@ -177,2 +177,7 @@ 'use strict';

}, {
key: 'shouldUpdate',
value: function shouldUpdate(generation) {
return !generation || generation >= this.generation;
}
}, {
key: 'id',

@@ -179,0 +184,0 @@ get: function () {

2

package.json
{
"name": "electrum-store",
"version": "1.8.0",
"version": "1.9.0",
"description": "Electrum store provides a store implementation tailored for Electrum.",

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

@@ -103,2 +103,23 @@ # Electrum Store

## Check the generation
State has an intrinsic _generation_ which can be retrieved with the
`generation` property. As soon as a state is attached to a store, its
generation will be a strictly positive integer (1...n).
The helper method `shouldUpdate()` returns `true` when the provided
generation is compatible with the state's own generation (i.e. equal
or more recent to the state generation).
```javascript
const store = Store.create ();
store.select ('a');
store.select ('a.b');
const state = store.select ('a.b');
expect (state.generation).to.equal (2);
expect (state.shouldUpdate (1)).to.be.false (); // provided gen=1 older than state.generation
expect (state.shouldUpdate (2)).to.be.true ();
expect (state.shouldUpdate (3)).to.be.true ();
```
# State

@@ -105,0 +126,0 @@

@@ -306,2 +306,23 @@ 'use strict';

});
describe ('shouldUpdate', () => {
it ('returns true for unknown generations', () => {
const store = Store.create ();
store.select ('a');
const state = store.select ('a.b.c');
expect (state.generation).to.equal (2);
expect (state.shouldUpdate ()).to.be.true ();
expect (state.shouldUpdate (0)).to.be.true ();
});
it ('returns true only for compatible generations', () => {
const store = Store.create ();
store.select ('a');
const state = store.select ('a.b.c');
expect (state.generation).to.equal (2);
expect (state.shouldUpdate (1)).to.be.false ();
expect (state.shouldUpdate (2)).to.be.true ();
expect (state.shouldUpdate (3)).to.be.true ();
});
});
});

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

}
shouldUpdate (generation) {
return !generation || generation >= this.generation;
}

@@ -186,0 +190,0 @@ static create (...args) {

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