Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Break bfsTransform into bfsTransform and bfsTraverse #3

Open
gaurav21r opened this issue Feb 4, 2016 · 1 comment
Open

Break bfsTransform into bfsTransform and bfsTraverse #3

gaurav21r opened this issue Feb 4, 2016 · 1 comment
Assignees

Comments

@gaurav21r
Copy link
Member

https://github.com/rcorp/jequel/blob/master/src/bfs-transform.coffee is pretty big and contains two different logical components.

We should break this down into bfsTraverse and bfsTransform. bfsTransform would be the same as before. bfsTraverse needs to have a simple API, where we would execute a function for every node traversed via Breadth First Search.

API and examples in my next comment

@gaurav21r
Copy link
Member Author

Signature of bfsTraverse according to me should be

bfsTraverse (objectToTraverse: {}, functionToCall: Function)
functionToCall (node: Object, parent: Object)

node, path = {
  path: <path of current node as a JSON Pointer>,
  value: <value of current node>
}

The Algorithm should be the one given in Wikipedia, https://en.wikipedia.org/wiki/Breadth-first_search#Pseudocode

@dpchn @prakash1517

dpchn added a commit that referenced this issue Feb 7, 2016
@gaurav21r gaurav21r added this to the Community Launch 0.8.0! milestone Feb 15, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants