electrum-store
Advanced tools
Comparing version 3.8.1 to 3.9.0
@@ -8,7 +8,7 @@ 'use strict'; | ||
var _state = require('./store/state.js'); | ||
var _state = require('./state.js'); | ||
var _state2 = _interopRequireDefault(_state); | ||
var _store = require('./store/store.js'); | ||
var _store = require('./store.js'); | ||
@@ -15,0 +15,0 @@ var _store2 = _interopRequireDefault(_store); |
{ | ||
"name": "electrum-store", | ||
"version": "3.8.1", | ||
"version": "3.9.0", | ||
"description": "Electrum store provides a store implementation tailored for Electrum.", | ||
@@ -9,3 +9,4 @@ "main": "lib/index.js", | ||
"clean": "rimraf ./lib && rimraf ./lib.test", | ||
"compile": "npm run clean && require-self && npm run babel", | ||
"compile": "npm run clean && require-self && npm run eslint && npm run babel", | ||
"eslint": "eslint src src.test", | ||
"mocha": "mocha lib.test/**/*.js", | ||
@@ -26,4 +27,4 @@ "prepublish": "npm run compile", | ||
"devDependencies": { | ||
"babel-env": "^1.6.0", | ||
"generic-js-env": "^1.9.2", | ||
"babel-env": "^2.3.1", | ||
"generic-js-env": "^2.2.0", | ||
"mai-chai": "^3.3.2", | ||
@@ -30,0 +31,0 @@ "react": "^15.4.2", |
@@ -26,3 +26,3 @@ /* global describe it */ | ||
it ('creates an empty state with initial values', () => { | ||
const state = State.create ('a', {'': 123, foo: 'bar'}); | ||
const state = State.create ('a', {'': 123, 'foo': 'bar'}); | ||
expect (state).to.exist (); | ||
@@ -201,3 +201,3 @@ expect (state).to.have.property ('id', 'a'); | ||
it ('freezes deeply an object', () => { | ||
const obj = {x: 1, y: {a: ['A', [{q: 'Q'}]]}}; | ||
const obj = {x: 1, y: {a: ['A', [ {q: 'Q'} ]]}}; | ||
State.freeze (obj); | ||
@@ -228,3 +228,3 @@ expect (Object.isFrozen (obj)).to.be.true (); | ||
it ('freezes top level only, but walks arrays', () => { | ||
const obj = [{x: 1, y: {a: 'A'}}]; | ||
const obj = [ {x: 1, y: {a: 'A'}} ]; | ||
State.freezeTop (obj); | ||
@@ -231,0 +231,0 @@ expect (Object.isFrozen (obj)).to.be.true (); |
@@ -101,3 +101,3 @@ /* global describe it */ | ||
it ('freezes deeply arrays up to the top level objects', () => { | ||
const state = State.create ('a').set ('x', [{a: 1}, [{b: {x: 2}}]]); | ||
const state = State.create ('a').set ('x', [{a: 1}, [ {b: {x: 2}} ]]); | ||
const ref = state.get ('x'); | ||
@@ -108,6 +108,6 @@ expect (Object.isFrozen (ref[0])).to.be.true (); | ||
expect (Object.isFrozen (ref[1][0].b)).to.be.false (); | ||
expect (ref).to.deep.equal ([{a: 1}, [{b: {x: 2}}]]); | ||
expect (ref).to.deep.equal ([{a: 1}, [ {b: {x: 2}} ]]); | ||
expect (() => ref[0].a = 0).to.throw (); | ||
expect (() => ref[1][0].b.x = 0).to.not.throw (); | ||
expect (ref).to.deep.equal ([{a: 1}, [{b: {x: 0}}]]); | ||
expect (ref).to.deep.equal ([{a: 1}, [ {b: {x: 0}} ]]); | ||
}); | ||
@@ -388,3 +388,3 @@ }); | ||
expect (fresh.id).to.equal ('a.0'); | ||
expect (state.indexKeys).to.deep.equal ([0]); | ||
expect (state.indexKeys).to.deep.equal ([ 0 ]); | ||
}); | ||
@@ -391,0 +391,0 @@ }); |
@@ -80,3 +80,3 @@ /* global describe it */ | ||
const store = Store.create (); | ||
const array = [{id: 'x', value: 'X'}]; | ||
const array = [ {id: 'x', value: 'X'} ]; | ||
@@ -165,7 +165,7 @@ expect (() => store.applyChanges ('root', array, 'value')).to.throw ('expects an array'); | ||
store.applyChanges ('root', [{offset: 12, id: 'y', value: {year: 1986}}]); | ||
store.applyChanges ('root', [ {offset: 12, id: 'y', value: {year: 1986}} ]); | ||
expect (store.find ('root.12.year').get ()).to.equal (1986); | ||
expect (store.find ('root.12.name').get ()).to.equal ('bar'); | ||
store.applyChanges ('root', [{offset: 12}]); | ||
store.applyChanges ('root', [ {offset: 12} ]); | ||
expect (store.find ('root.12')).to.not.exist (); | ||
@@ -172,0 +172,0 @@ }); |
@@ -27,3 +27,3 @@ /* global describe it */ | ||
expect (arr).to.have.length (1); | ||
expect (arr).to.deep.equal (['']); | ||
expect (arr).to.deep.equal ([ '' ]); | ||
}); | ||
@@ -34,3 +34,3 @@ | ||
expect (arr).to.have.length (1); | ||
expect (arr).to.deep.equal (['a']); | ||
expect (arr).to.deep.equal ([ 'a' ]); | ||
}); | ||
@@ -37,0 +37,0 @@ }); |
@@ -0,0 +0,0 @@ /* global describe it */ |
@@ -0,0 +0,0 @@ /* global describe it */ |
@@ -0,0 +0,0 @@ /* global describe it */ |
/* global describe it */ | ||
import {expect} from 'mai-chai'; | ||
import {State, Store} from 'electrum-store'; | ||
import {Store} from 'electrum-store'; | ||
@@ -6,0 +6,0 @@ describe ('Store', () => { |
@@ -0,0 +0,0 @@ /* global describe it */ |
@@ -0,0 +0,0 @@ /* global describe it */ |
@@ -0,0 +0,0 @@ /* global describe it */ |
@@ -1,4 +0,4 @@ | ||
'use strict'; | ||
import State from './state.js'; | ||
import Store from './store.js'; | ||
export State from './store/state.js'; | ||
export Store from './store/store.js'; | ||
export { State, Store }; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
125553
1