Skip to content

Commit

Permalink
0.0.4 also publish old values when using alter
Browse files Browse the repository at this point in the history
  • Loading branch information
podefr committed Apr 5, 2015
1 parent 27e2964 commit 4ebec3f
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 7 deletions.
6 changes: 6 additions & 0 deletions README.md
Expand Up @@ -237,6 +237,12 @@ store.loop(function (value, key, object) {
}, scope /* optional */);
```

CHANGELOG
=========

### 0.0.4 5 APR 2015

* Publish old value too when altering the store

LICENSE
=======
Expand Down
4 changes: 2 additions & 2 deletions index.js
Expand Up @@ -59,8 +59,8 @@ module.exports = function StoreConstructor($data) {
"deleted",
"added"].forEach(function (value) {
diffs[value].forEach(function (dataIndex) {
_storeObservable.notify(value, dataIndex, _data[dataIndex]);
_valueObservable.notify(dataIndex, _data[dataIndex], value);
_storeObservable.notify(value, dataIndex, _data[dataIndex], previousData[dataIndex]);
_valueObservable.notify(dataIndex, _data[dataIndex], value, previousData[dataIndex]);
});
});
};
Expand Down
2 changes: 1 addition & 1 deletion package.json
@@ -1,7 +1,7 @@
{
"name": "observable-store",
"description": "An observable data store with dirty checking and computed properties",
"version": "0.0.3",
"version": "0.0.4",
"homepage": "https://github.com/flams/observable-store",
"licenses": [
{
Expand Down
8 changes: 4 additions & 4 deletions test/observable-store.spec.js
Expand Up @@ -80,7 +80,7 @@ describe("Store", function () {

});

it("should allow for returning a JSON version of the store", function () {
it("should return a JSON version of the store", function () {
var values = {
key1: "value1",
key2: "value2"
Expand All @@ -93,7 +93,7 @@ describe("Store", function () {
expect(Object.getOwnPropertyNames(json).length).toBe(2);
});

it("should allow for deleting multiple indexes at once", function () {
it("should delete multiple indexes at once", function () {
// I'd like to keep [2, 7, 10] in the end
var indexes = [0, 9, 12, 4, 5, 6, 8, 1, 11, 3];
store.reset([0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]);
Expand Down Expand Up @@ -226,8 +226,7 @@ describe("Store", function () {
});

describe("value observable", function () {
var store = null,
storeObservable = null;
var store = null;

beforeEach(function () {
store = new Store();
Expand Down Expand Up @@ -481,6 +480,7 @@ describe("Store", function () {
// call.args[0] should equal 2 or 3
expect(call.args[0] >= 2).toBe(true);
expect(call.args[1]).toBeUndefined();
expect(call.args[2] >= 2).toBe(true);
});
});

Expand Down

0 comments on commit 4ebec3f

Please sign in to comment.