tree-crawl
Advanced tools
Comparing version 1.0.2 to 1.0.3
@@ -287,2 +287,3 @@ (function (global, factory) { | ||
if (null == root) return; | ||
options = options || {}; | ||
var order = options.order || 'pre'; | ||
@@ -289,0 +290,0 @@ var getChildren = options.getChildren || defaultGetChildren; |
@@ -1,1 +0,1 @@ | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.t=t():"function"==typeof define&&define.i?define(t):e.s=t()}(this,function(){"use strict";function e(e,t){this.flags=e,this.cursor=t}function t(t,n){return new e(t,n)}function n(e){this.o=[e],this.top=0}function i(e){return new n(e)}function s(){this.u=0,this.stack=i({h:null,index:-1})}function o(){return new s}function r(){this.p=!1,this.l=!1,this.remove=!1,this.replace=null}function u(){return new r}function h(e){return 0!==e.length}function p(e,n,s){for(var r=u(),p=o(),c=t(r,p),f=i(e),a=Object.assign({},e);!f.v();){var l=f.pop();if(l!==a){if(r.reset(),n(l,c),r.p)break;if(!r.remove&&(p.moveNext(),!r.l)){r.replace&&(l=r.replace);var d=s(l);h(d)&&(f.push(a),f.k(d),p.m(l))}}else p.g()}}function c(e,n,s){for(var r=u(),p=o(),c=t(r,p),f=i(e),a=i(null);!f.v();){var l=f.j(),d=a.j(),v=s(l);if(r.reset(),l!==d&&h(v))a.push(l),p.m(l),f.k(v);else{if(l===d&&(a.pop(),p.g()),f.pop(),n(l,c),r.p)break;if(r.remove)continue;p.moveNext()}}}function f(e){this.o=[e],this.top=0,this.maxLength=0}function a(e){return new f(e)}function l(){this.u=0,this.index=-1,this.q=a({h:null,N:1}),this.O=1,this.L=0}function d(){return new l}function v(e,n,i){for(var s=u(),o=d(),r=t(s,o),p=a(e);!p.v();){var c=p.A();if(s.reset(),n(c,r),s.p)break;if(!s.remove&&(o.moveNext(),s.replace&&(c=s.replace),!s.l)){var f=i(c);h(f)&&(p.D(f),o.R(c,f.length))}o.U()}}e.prototype={l:function(){this.flags.l=!0},p:function(){this.flags.p=!0},remove:function(){this.flags.remove=!0},replace:function(e){this.flags.replace=e},get parent(){return this.cursor.parent},get u(){return this.cursor.u},get level(){return this.cursor.u+1},get index(){return this.cursor.index}},n.prototype={push:function(e){++this.top<this.o.length?this.o[this.top]=e:this.o.push(e)},k:function(e){for(var t=e.length-1;t>=0;t--)this.push(e[t])},pop:function(){var e=this.j();return this.top--,e},j:function(){return this.o[this.top]},v:function(){return-1===this.top}},s.prototype={m:function(e){this.u++,this.stack.push({h:e,index:0})},g:function(){this.u--,this.stack.pop()},moveNext:function(){this.stack.j().index++},get parent(){return this.stack.j().h},get index(){return this.stack.j().index}},r.prototype={reset:function(){this.p=!1,this.l=!1,this.remove=!1,this.replace=null}};f.prototype={F:function(e){this.o.push(e)},D:function(e){for(var t=0,n=e.length;t<n;t++)this.F(e[t])},A:function(){var e=this.j();return 32768===++this.top&&(this.o=this.o.slice(this.top),this.top=0),e},j:function(){return this.o[this.top]},v:function(){return this.top===this.o.length}},l.prototype={R:function(e,t){this.q.F({h:e,N:t}),this.L+=t},moveNext:function(){this.index++},U:function(){this.q.j().N--,this.O--,0===this.q.j().N&&(this.index=0,this.q.A()),0===this.O&&(this.u++,this.O=this.L,this.L=0)},get parent(){return this.q.j().h}};var k=function(e){return e.children};return function(e,t,n){if(null!=e){var i=n.order||"pre",s=n.M||k;"pre"===i?p(e,t,s):"post"===i?c(e,t,s):"bfs"===i&&v(e,t,s)}}}); | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.t=t():"function"==typeof define&&define.i?define(t):e.s=t()}(this,function(){"use strict";function e(e,t){this.flags=e,this.cursor=t}function t(t,n){return new e(t,n)}function n(e){this.o=[e],this.top=0}function i(e){return new n(e)}function s(){this.u=0,this.stack=i({h:null,index:-1})}function o(){return new s}function r(){this.p=!1,this.l=!1,this.remove=!1,this.replace=null}function u(){return new r}function h(e){return 0!==e.length}function p(e,n,s){for(var r=u(),p=o(),c=t(r,p),f=i(e),a=Object.assign({},e);!f.v();){var l=f.pop();if(l!==a){if(r.reset(),n(l,c),r.p)break;if(!r.remove&&(p.moveNext(),!r.l)){r.replace&&(l=r.replace);var d=s(l);h(d)&&(f.push(a),f.k(d),p.m(l))}}else p.g()}}function c(e,n,s){for(var r=u(),p=o(),c=t(r,p),f=i(e),a=i(null);!f.v();){var l=f.j(),d=a.j(),v=s(l);if(r.reset(),l!==d&&h(v))a.push(l),p.m(l),f.k(v);else{if(l===d&&(a.pop(),p.g()),f.pop(),n(l,c),r.p)break;if(r.remove)continue;p.moveNext()}}}function f(e){this.o=[e],this.top=0,this.maxLength=0}function a(e){return new f(e)}function l(){this.u=0,this.index=-1,this.q=a({h:null,N:1}),this.O=1,this.L=0}function d(){return new l}function v(e,n,i){for(var s=u(),o=d(),r=t(s,o),p=a(e);!p.v();){var c=p.A();if(s.reset(),n(c,r),s.p)break;if(!s.remove&&(o.moveNext(),s.replace&&(c=s.replace),!s.l)){var f=i(c);h(f)&&(p.D(f),o.R(c,f.length))}o.U()}}e.prototype={l:function(){this.flags.l=!0},p:function(){this.flags.p=!0},remove:function(){this.flags.remove=!0},replace:function(e){this.flags.replace=e},get parent(){return this.cursor.parent},get u(){return this.cursor.u},get level(){return this.cursor.u+1},get index(){return this.cursor.index}},n.prototype={push:function(e){++this.top<this.o.length?this.o[this.top]=e:this.o.push(e)},k:function(e){for(var t=e.length-1;t>=0;t--)this.push(e[t])},pop:function(){var e=this.j();return this.top--,e},j:function(){return this.o[this.top]},v:function(){return-1===this.top}},s.prototype={m:function(e){this.u++,this.stack.push({h:e,index:0})},g:function(){this.u--,this.stack.pop()},moveNext:function(){this.stack.j().index++},get parent(){return this.stack.j().h},get index(){return this.stack.j().index}},r.prototype={reset:function(){this.p=!1,this.l=!1,this.remove=!1,this.replace=null}};f.prototype={F:function(e){this.o.push(e)},D:function(e){for(var t=0,n=e.length;t<n;t++)this.F(e[t])},A:function(){var e=this.j();return 32768===++this.top&&(this.o=this.o.slice(this.top),this.top=0),e},j:function(){return this.o[this.top]},v:function(){return this.top===this.o.length}},l.prototype={R:function(e,t){this.q.F({h:e,N:t}),this.L+=t},moveNext:function(){this.index++},U:function(){this.q.j().N--,this.O--,0===this.q.j().N&&(this.index=0,this.q.A()),0===this.O&&(this.u++,this.O=this.L,this.L=0)},get parent(){return this.q.j().h}};var k=function(e){return e.children};return function(e,t,n){if(null!=e){var i=(n=n||{}).order||"pre",s=n.M||k;"pre"===i?p(e,t,s):"post"===i?c(e,t,s):"bfs"===i&&v(e,t,s)}}}); |
@@ -42,2 +42,4 @@ import dfsPre from './lib/dfs-pre' | ||
options = options || {} | ||
// default options | ||
@@ -44,0 +46,0 @@ const order = options.order || 'pre' |
{ | ||
"name": "tree-crawl", | ||
"version": "1.0.2", | ||
"version": "1.0.3", | ||
"description": "Agnostic tree traversal library.", | ||
@@ -64,3 +64,3 @@ "author": "Nicolas Gryman <ngryman@gmail.com> (http://ngryman.sh/)", | ||
"devDependencies": { | ||
"ava": "^0.19.1", | ||
"ava": "^0.22.0", | ||
"babel-plugin-external-helpers": "^6.22.0", | ||
@@ -73,8 +73,8 @@ "babel-plugin-istanbul": "^4.1.1", | ||
"cross-env": "^5.0.0", | ||
"documentation": "^4.0.0-beta.19", | ||
"eslint": "^3.18.0", | ||
"documentation": "^5.3.3", | ||
"eslint": "^4.9.0", | ||
"eslint-config-ngryman": "^1.7.1", | ||
"nyc": "^10.2.0", | ||
"rollup": "^0.41.6", | ||
"rollup-plugin-babel": "^2.7.1", | ||
"nyc": "^11.2.1", | ||
"rollup": "^0.50.0", | ||
"rollup-plugin-babel": "^3.0.2", | ||
"rollup-plugin-cleanup": "^1.0.0", | ||
@@ -81,0 +81,0 @@ "rollup-plugin-commonjs": "^8.0.2", |
@@ -1,2 +0,2 @@ | ||
# tree-crawl [![travis][travis-image]][travis-url] [![codecov][codecov-image]][codecov-url] [![size][size-image]][size-url] | ||
# tree-crawl [![travis][travis-image]][travis-url] [![codecov][codecov-image]][codecov-url] [![greenkeeper][greenkeeper-image]][greenkeeper-url] [![size][size-image]][size-url] | ||
@@ -9,2 +9,4 @@ > Agnostic tree traversal library. | ||
[codecov-url]: https://codecov.io/github/ngryman/tree-crawl | ||
[greenkeeper-image]: https://badges.greenkeeper.io/ngryman/tree-crawl.svg | ||
[greenkeeper-url]: https://greenkeeper.io/ | ||
[size-image]: http://img.badgesize.io/https://unpkg.com/tree-crawl@1.0.0/dist/tree-crawl.min.js?compression=gzip | ||
@@ -11,0 +13,0 @@ [size-url]: https://unpkg.com/tree-crawl@1.0.0/dist/tree-crawl.min.js |
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
31510
724
283