Skip to content

Commit

Permalink
Merge pull request #62 from bjornstar/1.0.0-beta.5
Browse files Browse the repository at this point in the history
1.0.0-beta.5 - 2017-02-07
  • Loading branch information
bjornstar authored Feb 7, 2017
2 parents d8788b1 + 6f99dfc commit d9a9e55
Show file tree
Hide file tree
Showing 6 changed files with 76 additions and 3 deletions.
3 changes: 3 additions & 0 deletions .jshintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"proto": true
}
6 changes: 5 additions & 1 deletion HISTORY.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
#Tomes Release Notes

##1.0.0-beta.5
* Tomes now have a destroy method
* Add .jshintrc and run on tests

##1.0.0-beta.4
* Update `README.md` to fix first link

##1.0.0-beta.3
* Update `README.md` to point to this fork.
* Update `README.md` to point to this fork

##1.0.0-beta.2
* Tomes now have an unTome method
Expand Down
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,9 @@ Get all change operations from the Tome
###merge( *diff* )
Applies a change operation or an array of change operations to a Tome.

###destroy( )
Makes the tome and all of it's sub-tomes emit destroy. Does not delete anything.

###unTome( )
Returns a regular javascript version of your Tome.

Expand Down
4 changes: 4 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -630,6 +630,10 @@ Tome.prototype.unTome = function () {
return Tome.unTome(this);
};

Tome.prototype.destroy = function () {
return Tome.destroy(this);
};

Tome.prototype.set = function (key, val) {

// We use this to set a property on a Tome to the specified value. This can
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
{
"name": "@bjornstar/tomes",
"description": "Evented Storage Agnostic Data API",
"version": "1.0.0-beta.4",
"version": "1.0.0-beta.5",
"author": "Bjorn Stromberg <bjornstar@gmail.com>",
"maintainers": [
{ "name": "Bjorn Stromberg", "email": "bjornstar@gmail.com" }
],
"scripts": {
"test": "node test"
"test": "jshint index.js && node test"
},
"main": "index.js",
"devDependencies": {
Expand Down
59 changes: 59 additions & 0 deletions test/modules/destroy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
var Tome = require('../..');

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

var a = { b: { c: 1 }, d: { e: 1} };
var b = Tome.conjure(a);

function fail() {
test.ok();
}

function ok() {
test.ok(true);
}

b.on('readable', fail);

b.on('destroy', ok);
b.b.on('destroy', ok);
b.b.c.on('destroy', ok);
b.d.on('destroy', ok);
b.d.e.on('destroy', ok);

b.destroy();
// Calling a 2nd time shouldn't have any effect.
b.destroy();

test.done();
};

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

var a = { b: { c: 1 }, d: { e: 1} };
var b = Tome.conjure(a);

function fail() {
test.ok();
}

function ok() {
test.ok(true);
}

b.on('readable', fail);

b.on('destroy', ok);
b.b.on('destroy', ok);
b.b.c.on('destroy', ok);
b.d.on('destroy', ok);
b.d.e.on('destroy', ok);

Tome.destroy(b);
// Calling a 2nd time shouldn't have any effect.
Tome.destroy(b);

test.done();
};

0 comments on commit d9a9e55

Please sign in to comment.