From 056513a13a5551b07b5e8b3d3a16e27e314135a1 Mon Sep 17 00:00:00 2001 From: Bjorn Stromberg Date: Wed, 9 Nov 2016 12:29:29 +0900 Subject: [PATCH] v1.0.0-beta.2 - 2016-11-09 --- HISTORY.md | 11 +++++++++++ index.js | 6 +++++- package.json | 2 +- test/modules/array.js | 4 ++-- test/modules/object.js | 4 ++-- test/modules/untome.js | 18 ++++++++++++++++-- 6 files changed, 37 insertions(+), 8 deletions(-) diff --git a/HISTORY.md b/HISTORY.md index ed1fefd..11e58dd 100644 --- a/HISTORY.md +++ b/HISTORY.md @@ -1,5 +1,16 @@ #Tomes Release Notes +##1.0.0-beta.2 + * Tomes now have an unTome method + * Fix a few lint errors in tests + +##1.0.0-beta.1 + * Remove component.json + * Always use node events library + * Now available as @bjornstar/tomes + * Export Tome directly + * Put types on Tome itself + ##0.1.0 * Removed the hide method, it was useless and only increased code complexity. * Added nodei.co badge. diff --git a/index.js b/index.js index cc50984..ab4f600 100644 --- a/index.js +++ b/index.js @@ -626,6 +626,10 @@ Tome.prototype.getParent = function () { return this.__parent__; }; +Tome.prototype.unTome = function () { + return Tome.unTome(this); +}; + Tome.prototype.set = function (key, val) { // We use this to set a property on a Tome to the specified value. This can @@ -1337,7 +1341,7 @@ ArrayTome.prototype.rename = function () { for (oldKey in rO) { newKey = rO[oldKey]; if (!this.hasOwnProperty(oldKey)) { - throw new ReferenceError('ObjectTome.rename - Key is not defined: ' + oldKey); + throw new ReferenceError('ArrayTome.rename - Key is not defined: ' + oldKey); } this._arr[oldKey].__key__ = newKey; diff --git a/package.json b/package.json index 9a1699e..70c8c13 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "@bjornstar/tomes", "description": "Evented Storage Agnostic Data API", - "version": "1.0.0-beta.1", + "version": "1.0.0-beta.2", "author": "Bjorn Stromberg ", "maintainers": [ { "name": "Bjorn Stromberg", "email": "bjornstar@gmail.com" } diff --git a/test/modules/array.js b/test/modules/array.js index e327c9f..9739f4b 100755 --- a/test/modules/array.js +++ b/test/modules/array.js @@ -1161,11 +1161,11 @@ exports.testCircularEntries = function (test) { var circRefs = new CircularReference(); test.throws(function () { - var b = Tome.conjure(circRefs); + Tome.conjure(circRefs); }, TypeError); test.throws(function () { - var b = Tome.conjure([ circRefs ]); + Tome.conjure([ circRefs ]); }, TypeError); var a = [ null, null, null, null ]; diff --git a/test/modules/object.js b/test/modules/object.js index 1119472..d43fb09 100755 --- a/test/modules/object.js +++ b/test/modules/object.js @@ -314,11 +314,11 @@ exports.testCircularReferences = function (test) { var circRefs = new CircularReferences(); test.throws(function () { - var b = Tome.conjure(circRefs); + Tome.conjure(circRefs); }, TypeError, 'expected a TypeError'); test.throws(function () { - var b = Tome.conjure({ a: circRefs }); + Tome.conjure({ a: circRefs }); }, TypeError, 'expected a TypeError'); var a = { b: 1 }; diff --git a/test/modules/untome.js b/test/modules/untome.js index 2f3e332..4e5ecff 100644 --- a/test/modules/untome.js +++ b/test/modules/untome.js @@ -69,10 +69,13 @@ exports.unTomeComplex = function (test) { exports.unTomeRepeated = function (test) { test.expect(1); + var a = [ undefined, undefined, undefined, undefined ]; + test.doesNotThrow(function () { - var b = Tome.unTome(a); + Tome.unTome(a); }); + test.done(); }; @@ -86,8 +89,19 @@ exports.unTomeCircularReference = function (test) { var circRefs = new CircularReference(); test.throws(function () { - var b = Tome.unTome(circRefs); + Tome.unTome(circRefs); }, TypeError, 'expected a TypeError'); test.done(); }; + +exports.unTomeSelf = function (test) { + test.expect(1); + + var a = { a: '1', b: false, c: null, d: 1234.5667 }; + var b = Tome.conjure(a); + + test.strictEqual(trueName(a), trueName(b.unTome())); + + test.done(); +};