Skip to content

Commit

Permalink
Merge pull request #23 from bjornstar/master
Browse files Browse the repository at this point in the history
v0.0.16: Fixed an issue where keys were not getting updated when splicing an array.
  • Loading branch information
Ron Korving committed Oct 22, 2013
2 parents 2f1daa4 + cf02405 commit a36638a
Show file tree
Hide file tree
Showing 10 changed files with 22 additions and 4 deletions.
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
[![Build Status](https://travis-ci.org/Wizcorp/node-tomes.png)](https://travis-ci.org/Wizcorp/node-tomes)

Tomes
=========
=====

*Evented Storage Agnostic Data API*

![Tomes Logo](https://raw.github.com/bjornstar/tomes/master/logo/tomes-logo-small.png)

Problem: You've got data and you want to do something whenever it changes.

Access and modify your data through the Tomes API and you'll get change events.
Expand Down
2 changes: 1 addition & 1 deletion component.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "tomes",
"repo": "bjornstar/tomes",
"description": "Evented Storage Agnostic Data API",
"version": "0.0.14",
"version": "0.0.16",
"keywords": [ "data", "events" ],
"dependencies": {
"component/emitter": "*"
Expand Down
Binary file added logo/tomes-logo-big.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added logo/tomes-logo-less-big.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added logo/tomes-logo-medium.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added logo/tomes-logo-small.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "tomes",
"description": "Evented Storage Agnostic Data API",
"version": "0.0.14",
"version": "0.0.16",
"author": "Wizcorp, Inc. <info@wizcorp.jp>",
"maintainers": [
{ "name": "Bjorn Stromberg", "email": "bstromberg@wizcorp.jp" }
Expand Down
1 change: 0 additions & 1 deletion scripts/jshint.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@


// ECMAScript 5.
"es5" : true, // Allow ECMAScript 5 syntax.
"strict" : false, // Require `use strict` pragma in every file.
"globalstrict" : true, // Allow global "use strict" (also enables 'strict').

Expand Down
16 changes: 16 additions & 0 deletions test/modules/array.js
Original file line number Diff line number Diff line change
Expand Up @@ -1095,5 +1095,21 @@ exports.testSplice = function (test) {

test.strictEqual(JSON.stringify(a), JSON.stringify(b));

test.done();
};

exports.testSpliceKeys = function (test) {
test.expect(5);

var a = [ 0, 1, 2, 3, 4, 5 ];
var b = Tome.conjure(a);

a.splice(0, 1);
b.splice(0, 1);

for (var i = 0; i < b.length; i += 1) {
test.strictEqual(i, b[i].getKey());
}

test.done();
};
1 change: 1 addition & 0 deletions tomes.js
Original file line number Diff line number Diff line change
Expand Up @@ -1259,6 +1259,7 @@ ArrayTome.prototype.splice = function (spliceIndex, toRemove) {

for (i = 0, len = this._arr.length; i < len; i += 1) {
this[i] = this._arr[i];
this[i].__key__ = i;
}

if (out.length > toAdd.length) {
Expand Down

0 comments on commit a36638a

Please sign in to comment.