Coder Social home page Coder Social logo

arboreal's People

Contributors

afiore avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

arboreal's Issues

License is unspecified.

I like to use arboreal within my code. Could I assume it is MIT license.

Thanks for the wonderful library.

Removing nodes does not compact the IDs

Hi all,

It seems to me that the removing a node from the tree does not adjust the IDs of the nodes. This would be okay, if only adding a child to a node did not use length as a value for the ID of a new node being created.

E.G.
root with 3 children, (A,B,C)
ID A: 0/0
ID B: 0/1
ID C: 0/2
length:3

Calling B.remove() will leave the tree in this state

root with 2 children, (A,C)
ID A: 0/0
ID C: 0/2
length:2

Adding a new node D:
root with 3 children, (A,C,D)
ID A: 0/0
ID C: 0/2
ID D: 0/2
length:3

This results in element D disappearing from iterations over the tree.

Problem to include arboreal in node

Hi,

I am not sure it's really an issue with arboreal, as I am rather a noob in javascript. If this is the case, please tell me.
Anyway, I would like to play with arboreal on the console on node.js.
I installed the package as described by cloning this repo and then running nmp install.

However, when I want to load that from the console, I get:

var tmp = require("./lib/arboreal")
undefined
tmp
{ [Function: Arboreal] parse: [Function] }
var tree = new Arboreal();
ReferenceError: Arboreal is not defined
at repl:1:16
at REPLServer.self.eval (repl.js:111:21)
at rli.on.e (repl.js:260:20)
at REPLServer.self.eval (repl.js:118:5)
at Interface. (repl.js:250:12)
at Interface.EventEmitter.emit (events.js:88:17)
at Interface._onLine (readline.js:199:10)
at Interface._line (readline.js:517:8)
at Interface._ttyWrite (readline.js:735:14)
at ReadStream.onkeypress (readline.js:98:10)
var tree = new tmp.Arboreal();
TypeError: undefined is not a function
at repl:1:12
at REPLServer.self.eval (repl.js:111:21)
at rli.on.e (repl.js:260:20)
at REPLServer.self.eval (repl.js:118:5)
at Interface. (repl.js:250:12)
at Interface.EventEmitter.emit (events.js:88:17)
at Interface._onLine (readline.js:199:10)
at Interface._line (readline.js:517:8)
at Interface._ttyWrite (readline.js:735:14)
at ReadStream.onkeypress (readline.js:98:10)

And I can't reproduce the example.

Any pointer would be really appreciated!

Sam

jasmine doesn't work for new downloads

please explain how in the world jasmine is supposed to work for this?

should it be running on node.js? i've wasted at least 5 hours trying to figure it out

README.md error

In the last line o USAGE, in README.md, there is an error:

var tree = Arborel.parse(wikipediaJsCategory, 'subcategories');

Arborel misses an 'a'!

this undefined when loading arboreal.js

I have an error when loading arboreal.js (same error with built file, too):

I'm on a Mac with Chrome.

Uncaught TypeError: Cannot set property 'Arboreal' of undefined

Error is on line 247 of arboreal.js #fee6ba821 , with an anonymous function stacktrace going from 247 to 250 (and that's it).

Via Chrome's inspector:

 if (typeof module !== 'undefined' && module.exports) {
    module.exports = Arboreal;
  } else {
    this.Arboreal = Arboreal;
Uncaught TypeError: Cannot set property 'Arboreal' of undefined
  }

Thanks.

Suggesting Additional Method

Thanks for a nice tree library!

For our project, I've enhanced it with the following method that permits user code to specify a beginning node for a traverseDown operation. Only that node and its descendants are traversed.

Arboreal.prototype.traverseDownFrom = function (node,iterator) {
_traverse(node, iterator, _traverseDown);
};

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.