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

electrum-store

Package Overview
Dependencies
Maintainers
3
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 3.7.0 to 3.8.0

29

lib/store/state.js

@@ -77,7 +77,7 @@ 'use strict';

} else {
Object.freeze(values);
for (let key of Object.getOwnPropertyNames(values)) {
State.freezeTop(values[key]);
}
Object.freeze(values);
for (let key of Object.getOwnPropertyNames(values)) {
State.freezeTop(values[key]);
}
}

@@ -142,3 +142,3 @@ this._id = id;

value: function remove(id) {
if (id === undefined && arguments.length === 0) {
if (State.isAutoSelector(id, arguments.length)) {
return this.store.remove(this.id);

@@ -151,3 +151,3 @@ }

value: function select(id) {
if (id === undefined && arguments.length === 0) {
if (State.isAutoSelector(id, arguments.length)) {
return this;

@@ -160,3 +160,3 @@ }

value: function find(id) {
if (id === undefined && arguments.length === 0) {
if (State.isAutoSelector(id, arguments.length)) {
return this;

@@ -169,3 +169,3 @@ }

value: function any(id) {
if (id === undefined && arguments.length === 0) {
if (State.isAutoSelector(id, arguments.length)) {
return !isEmpty(this._values) || this.keys.length > 0;

@@ -275,3 +275,3 @@ }

value: function createRootState(store, values) {
let initialGeneration = arguments.length <= 2 || arguments[2] === undefined ? 0 : arguments[2];
let initialGeneration = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;

@@ -432,2 +432,13 @@ return new State(secretKey, '', store, initialGeneration, values || emptyValues);

}, {
key: 'isAutoSelector',
value: function isAutoSelector(id, length) {
if (id === undefined && length === 0) {
return true;
}
if (id === '*') {
return true;
}
return false;
}
}, {
key: 'freeze',

@@ -434,0 +445,0 @@ value: function freeze(obj) {

@@ -170,3 +170,3 @@ 'use strict';

value: function getIndexIds(startId) {
return this.getIndexKeys(startId).map(key => `${ startId }.${ key }`);
return this.getIndexKeys(startId).map(key => `${startId}.${key}`);
}

@@ -243,3 +243,3 @@ }, {

value: function applyChanges(id, obj) {
let defaultKey = arguments.length <= 2 || arguments[2] === undefined ? '' : arguments[2];
let defaultKey = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '';

@@ -246,0 +246,0 @@ if (typeof obj === 'undefined') {

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

@@ -22,7 +22,7 @@ "main": "lib/index.js",

"dependencies": {
"electrum-utils": "^1.6.0"
"electrum-utils": "^1.6.1"
},
"devDependencies": {
"babel-env": "^1.3.1",
"generic-js-env": "^1.7.0",
"generic-js-env": "^1.9.0",
"mai-chai": "^3.1.0",

@@ -29,0 +29,0 @@ "react": "^15.4.2",

@@ -321,2 +321,5 @@ # Electrum Store

> Note that you can use `find('*')` as a synonym to `find()`, which both
> return themself.
## Arity

@@ -323,0 +326,0 @@

@@ -140,2 +140,9 @@ /* global describe it */

it ('with "*" selects self', () => {
const store = Store.create ();
const state1 = store.select ('a');
const state2 = state1.select ('*');
expect (state2).to.equal (state1);
});
it ('throws for invalid ids', () => {

@@ -196,2 +203,9 @@ const store = Store.create ();

it ('with "*" finds self', () => {
const store = Store.create ();
const state1 = store.select ('a');
const state2 = state1.find ('*');
expect (state2).to.equal (state1);
});
it ('throws for invalid ids', () => {

@@ -198,0 +212,0 @@ const store = Store.create ();

@@ -150,3 +150,3 @@ 'use strict';

remove (id) {
if ((id === undefined) && (arguments.length === 0)) {
if (State.isAutoSelector (id, arguments.length)) {
return this.store.remove (this.id);

@@ -158,3 +158,3 @@ }

select (id) {
if ((id === undefined) && (arguments.length === 0)) {
if (State.isAutoSelector (id, arguments.length)) {
return this;

@@ -166,3 +166,3 @@ }

find (id) {
if ((id === undefined) && (arguments.length === 0)) {
if (State.isAutoSelector (id, arguments.length)) {
return this;

@@ -174,3 +174,3 @@ }

any (id) {
if ((id === undefined) && (arguments.length === 0)) {
if (State.isAutoSelector (id, arguments.length)) {
return !isEmpty (this._values) || this.keys.length > 0;

@@ -370,2 +370,12 @@ }

static isAutoSelector (id, length) {
if ((id === undefined) && length === 0) {
return true;
}
if (id === '*') {
return true;
}
return false;
}
static freeze (obj) {

@@ -372,0 +382,0 @@ if (Array.isArray (obj)) {

Sorry, the diff of this file is not supported yet

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