Comparing version 0.9.0 to 0.10.0
# Changelog | ||
## 0.10.0 | ||
- Added `getRoot` method to access root branch | ||
``` | ||
Uglified : 2.3kb | ||
Gzipped : 0.927kb | ||
``` | ||
## 0.9.0 | ||
@@ -8,2 +17,7 @@ | ||
``` | ||
Uglified : 2.26kb | ||
Gzipped : 0.919kb | ||
``` | ||
## 0.8.0 | ||
@@ -10,0 +24,0 @@ |
@@ -1,2 +0,2 @@ | ||
module.exports=function(t){function n(e){if(r[e])return r[e].exports;var i=r[e]={exports:{},id:e,loaded:!1};return t[e].call(i.exports,i,i.exports,n),i.loaded=!0,i.exports}var r={};return n.m=t,n.c=r,n.p="",n(0)}([function(t,n,r){function e(t){this._path=[],this._root=this,this._state=t}var i=r(4),u=r(5),o=r(2);e.prototype={getPath:function(t){return t?this._path.concat(t):this._path},commit:function(t){this._root._state=t},get:function(t){function n(n,r){return t.apply(this,arguments)}return n.toString=function(){return t.toString()},n}(function(t,n){return o(this._state,this.getPath(t),n)}),set:function(t,n){1===arguments.length&&(n=arguments[0],t=void 0),this.commit(i(this._state,this.getPath(t),n))},remove:function(t){this.commit(u(this._state,this.getPath(t)))},graft:function(t){return Object.create(this,{_path:{value:this.getPath(t)}})},keys:function(){return Object.keys(this.valueOf()||{})},values:function(){var t=this;return this.keys().map(function(n){return t.get(n)})},valueOf:function(){return o(this._state,this.getPath())},toJSON:function(){return this.valueOf()},is:function(t){return t.valueOf()==this.valueOf()},find:function(){return this.filter.apply(this,arguments)[0]}};var s=["map","reduce","filter","forEach"];s.forEach(function(t){e.prototype[t]=function(){var n;return(n=this.values())[t].apply(n,arguments)}}),t.exports=e},function(t,n,r){t.exports=function(t){if(Array.isArray(t))return t.slice();var n={};for(var r in t)n[r]=t[r];return n}},function(t,n,r){var e=r(3);t.exports=function(t,n,r){for(var i=!0;i;){a=f=void 0,i=!1;var u=t,o=n,s=r,a=o[0],f=o.slice(1);if(!a)return u;if(e(u,o)===!1)return s;if(!f.length)return u[a];t=u[a],n=f,i=!0}}},function(t,n,r){t.exports=function(t,n){var r=!0;t:for(;r;){u=o=s=a=void 0,r=!1;var e=t,i=n,u=i[0],o=i.slice(1),s=void 0!==e,a=s&&u in e;if(o.length){if(a){t=e[u],n=o,r=!0;continue t}return!1}return a}}},function(t,n,r){var e=r(1),i=r(2);t.exports=function u(t,n,r){if(i(t,n)===r)return t;var o=n[0],s=n.slice(1),a=e(t);return s.length?a[o]=u(o in a?a[o]:{},s,r):a[o]=r,a}},function(t,n,r){var e=r(1),i=r(3);t.exports=function u(t,n){if(i(t,n)===!1)return t;var r=n[0],o=n.slice(1),s=e(t);return o.length?s[r]=u(t[r],o):delete s[r],s}}]); | ||
module.exports=function(t){function n(e){if(r[e])return r[e].exports;var i=r[e]={exports:{},id:e,loaded:!1};return t[e].call(i.exports,i,i.exports,n),i.loaded=!0,i.exports}var r={};return n.m=t,n.c=r,n.p="",n(0)}([function(t,n,r){function e(t){this._path=[],this._root=this,this._state=t}var i=r(4),o=r(5),u=r(2);e.prototype={getPath:function(t){return t?this._path.concat(t):this._path},getRoot:function(){return this._root},commit:function(t){this._root._state=t},get:function(t){function n(n,r){return t.apply(this,arguments)}return n.toString=function(){return t.toString()},n}(function(t,n){return u(this._state,this.getPath(t),n)}),set:function(t,n){1===arguments.length&&(n=arguments[0],t=void 0),this.commit(i(this._state,this.getPath(t),n))},remove:function(t){this.commit(o(this._state,this.getPath(t)))},graft:function(t){return Object.create(this,{_path:{value:this.getPath(t)}})},keys:function(){return Object.keys(this.valueOf()||{})},values:function(){var t=this;return this.keys().map(function(n){return t.get(n)})},valueOf:function(){return u(this._state,this.getPath())},toJSON:function(){return this.valueOf()},is:function(t){return t.valueOf()==this.valueOf()},find:function(){return this.filter.apply(this,arguments)[0]}};var s=["map","reduce","filter","forEach"];s.forEach(function(t){e.prototype[t]=function(){var n;return(n=this.values())[t].apply(n,arguments)}}),t.exports=e},function(t,n,r){t.exports=function(t){if(Array.isArray(t))return t.slice();var n={};for(var r in t)n[r]=t[r];return n}},function(t,n,r){var e=r(3);t.exports=function(t,n,r){for(var i=!0;i;){a=f=void 0,i=!1;var o=t,u=n,s=r,a=u[0],f=u.slice(1);if(!a)return o;if(e(o,u)===!1)return s;if(!f.length)return o[a];t=o[a],n=f,i=!0}}},function(t,n,r){t.exports=function(t,n){var r=!0;t:for(;r;){o=u=s=a=void 0,r=!1;var e=t,i=n,o=i[0],u=i.slice(1),s=void 0!==e,a=s&&o in e;if(u.length){if(a){t=e[o],n=u,r=!0;continue t}return!1}return a}}},function(t,n,r){var e=r(1),i=r(2);t.exports=function o(t,n,r){if(i(t,n)===r)return t;var u=n[0],s=n.slice(1),a=e(t);return s.length?a[u]=o(u in a?a[u]:{},s,r):a[u]=r,a}},function(t,n,r){var e=r(1),i=r(3);t.exports=function o(t,n){if(i(t,n)===!1)return t;var r=n[0],u=n.slice(1),s=e(t);return u.length?s[r]=o(t[r],u):delete s[r],s}}]); | ||
//# sourceMappingURL=Foliage.js.map |
{ | ||
"name": "foliage", | ||
"version": "0.9.0", | ||
"version": "0.10.0", | ||
"description": "A cursor like tree data structure.", | ||
@@ -5,0 +5,0 @@ "main": "dist/Foliage.js", |
@@ -142,4 +142,4 @@ import Foliage from '../Foliage' | ||
it ('returns the subset if it is a cursor', function() { | ||
let plant = new Foliage({ first: data }) | ||
let query = plant.graft('first') | ||
let plant = new Foliage({ first: { second: data } }) | ||
let query = plant.graft([ 'first', 'second' ]) | ||
@@ -150,2 +150,13 @@ query.toJSON().should.equal(data) | ||
describe('Foliage::getRoot', function() { | ||
it ('returns the root plant', function() { | ||
let plant = new Foliage() | ||
let query = plant.graft('child') | ||
let subquery = query.graft('child') | ||
subquery.getRoot().should.equal(plant) | ||
}) | ||
}) | ||
}) |
@@ -21,2 +21,6 @@ /** | ||
getRoot() { | ||
return this._root | ||
}, | ||
commit(state) { | ||
@@ -23,0 +27,0 @@ this._root._state = state |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
40436
455