Comparing version 0.13.0 to 0.14.0
# Changelog | ||
## 0.14.0 | ||
- Added `size` method | ||
``` | ||
Uglified : 2.45kb | ||
Gzipped : 0.967kb | ||
``` | ||
## 0.13.0 | ||
@@ -8,4 +17,4 @@ | ||
``` | ||
Uglified : 2.31kb | ||
Gzipped : 0.932kb | ||
Uglified : 2.4kb | ||
Gzipped : 0.955kb | ||
``` | ||
@@ -12,0 +21,0 @@ |
@@ -1,2 +0,2 @@ | ||
module.exports=function(t){function e(r){if(n[r])return n[r].exports;var i=n[r]={exports:{},id:r,loaded:!1};return t[r].call(i.exports,i,i.exports,e),i.loaded=!0,i.exports}var n={};return e.m=t,e.c=n,e.p="",e(0)}([function(t,e,n){function r(t){this._path=[],this._root=this,this._state=t}var i=n(4),o=n(5),u=n(2);r.prototype={getPath:function(t){return this._path.concat(t).filter(function(t){return void 0!==t})},getRoot:function(){return this._root},getState:function(){return this.getRoot()._state},commit:function(t){this.getRoot()._state=t},get:function(t,e){return u(this.getState(),this.getPath(t),e)},set:function(t,e){1===arguments.length&&(t=void 0,e=arguments[0]),this.commit(i(this.getState(),this.getPath(t),e))},remove:function(t){this.commit(o(this.getState(),this.getPath(t)))},refine: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(e){return t.get(e)})},valueOf:function(){return u(this.getState(),this.getPath())},toJSON:function(){return this.valueOf()},is:function(t){return t.valueOf()==this.valueOf()},find:function(){return this.filter.apply(this,arguments)[0]},first:function(){return this.values().shift()},last:function(){return this.values().pop()}};var s=["sort","map","reduce","filter","forEach","some","every","join"];s.forEach(function(t){r.prototype[t]=function(){var e;return(e=this.values())[t].apply(e,arguments)}}),t.exports=r},function(t,e,n){t.exports=function(t){if(Array.isArray(t))return t.slice();var e={};for(var n in t)e[n]=t[n];return e}},function(t,e,n){var r=n(3);t.exports=function(t,e,n){for(var i=!0;i;){a=f=void 0,i=!1;var o=t,u=e,s=n,a=u[0],f=u.slice(1);if(!a)return o;if(r(o,u)===!1)return s;if(!f.length)return o[a];t=o[a],e=f,i=!0}}},function(t,e,n){t.exports=function(t,e){var n=!0;t:for(;n;){o=u=s=a=void 0,n=!1;var r=t,i=e,o=i[0],u=i.slice(1),s=void 0!==r,a=s&&o in r;if(u.length){if(a){t=r[o],e=u,n=!0;continue t}return!1}return a}}},function(t,e,n){var r=n(1),i=n(2);t.exports=function o(t,e,n){if(i(t,e)===n)return t;var u=e[0],s=e.slice(1),a=r(t);return s.length?a[u]=o(u in a?a[u]:{},s,n):a[u]=n,a}},function(t,e,n){var r=n(1),i=n(3);t.exports=function o(t,e){if(i(t,e)===!1)return t;var n=e[0],u=e.slice(1),s=r(t);return u.length?s[n]=o(t[n],u):delete s[n],s}}]); | ||
module.exports=function(t){function e(r){if(n[r])return n[r].exports;var i=n[r]={exports:{},id:r,loaded:!1};return t[r].call(i.exports,i,i.exports,e),i.loaded=!0,i.exports}var n={};return e.m=t,e.c=n,e.p="",e(0)}([function(t,e,n){function r(t){this._path=[],this._root=this,this._state=t}var i=n(4),o=n(5),u=n(2);r.prototype={getPath:function(t){return this._path.concat(t).filter(function(t){return void 0!==t})},getRoot:function(){return this._root},getState:function(){return this.getRoot()._state},commit:function(t){this.getRoot()._state=t},get:function(t,e){return u(this.getState(),this.getPath(t),e)},set:function(t,e){1===arguments.length&&(t=void 0,e=arguments[0]),this.commit(i(this.getState(),this.getPath(t),e))},remove:function(t){this.commit(o(this.getState(),this.getPath(t)))},refine: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(e){return t.get(e)})},valueOf:function(){return u(this.getState(),this.getPath())},toJSON:function(){return this.valueOf()},is:function(t){return t.valueOf()==this.valueOf()},find:function(){return this.filter.apply(this,arguments)[0]},first:function(){return this.values().shift()},last:function(){return this.values().pop()},size:function(){return this.values().length}};var s=["sort","map","reduce","filter","forEach","some","every","join"];s.forEach(function(t){r.prototype[t]=function(){var e;return(e=this.values())[t].apply(e,arguments)}}),t.exports=r},function(t,e,n){t.exports=function(t){if(Array.isArray(t))return t.slice();var e={};for(var n in t)e[n]=t[n];return e}},function(t,e,n){var r=n(3);t.exports=function(t,e,n){for(var i=!0;i;){a=f=void 0,i=!1;var o=t,u=e,s=n,a=u[0],f=u.slice(1);if(!a)return o;if(r(o,u)===!1)return s;if(!f.length)return o[a];t=o[a],e=f,i=!0}}},function(t,e,n){t.exports=function(t,e){var n=!0;t:for(;n;){o=u=s=a=void 0,n=!1;var r=t,i=e,o=i[0],u=i.slice(1),s=void 0!==r,a=s&&o in r;if(u.length){if(a){t=r[o],e=u,n=!0;continue t}return!1}return a}}},function(t,e,n){var r=n(1),i=n(2);t.exports=function o(t,e,n){if(i(t,e)===n)return t;var u=e[0],s=e.slice(1),a=r(t);return s.length?a[u]=o(u in a?a[u]:{},s,n):a[u]=n,a}},function(t,e,n){var r=n(1),i=n(3);t.exports=function o(t,e){if(i(t,e)===!1)return t;var n=e[0],u=e.slice(1),s=r(t);return u.length?s[n]=o(t[n],u):delete s[n],s}}]); | ||
//# sourceMappingURL=Foliage.js.map |
{ | ||
"name": "foliage", | ||
"version": "0.13.0", | ||
"version": "0.14.0", | ||
"description": "A cursor like tree data structure.", | ||
@@ -5,0 +5,0 @@ "main": "dist/Foliage.js", |
@@ -69,4 +69,2 @@ import Foliage from '../Foliage' | ||
describe('Foliage::first', function() { | ||
let even = n => (n % 2 === 0) | ||
it ('returns the first value in an array', function() { | ||
@@ -84,4 +82,2 @@ let plant = new Foliage([ 1, 2, 3, 4]) | ||
describe('Foliage::last', function() { | ||
let even = n => (n % 2 === 0) | ||
it ('returns the last value in an array', function() { | ||
@@ -98,2 +94,14 @@ let plant = new Foliage([ 1, 2, 3, 4]) | ||
describe('Foliage::size', function() { | ||
it ('returns the last value in an array', function() { | ||
let plant = new Foliage([ 1, 2, 3, 4]) | ||
plant.size().should.equal(4) | ||
}) | ||
it ('returns the last value of an object', function() { | ||
let plant = new Foliage({ a: 1, b: 2, c: 3 }) | ||
plant.size().should.equal(3) | ||
}) | ||
}) | ||
}) |
@@ -89,2 +89,6 @@ /** | ||
return this.values().pop() | ||
}, | ||
size() { | ||
return this.values().length | ||
} | ||
@@ -91,0 +95,0 @@ |
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
46596
538