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

Rewrite of select and where #2

Open
gaurav21r opened this issue Feb 4, 2016 · 7 comments
Open

Rewrite of select and where #2

gaurav21r opened this issue Feb 4, 2016 · 7 comments
Assignees

Comments

@gaurav21r
Copy link
Member

Since we have migrated jequel to the new format, we have to rewrite the select and where code in CS and with new bfs functions.

@dpchn Please handle this. @prakash1517 @riteshe63 your inputs please!

The API for select according to me should be:

jequel.query(obj, {
  select: '0/*/*'
})
// For obj = [{a: {b: 1, c: 2}}]
// Returns [1, 2]  

jequel.query(obj, {
  select: '0/*'
})

//Returns [{b: 1, c: 2}]

Then we can move on to where

@dpchn
Copy link
Collaborator

dpchn commented Feb 4, 2016

Yes i have understood

@riteshe63
Copy link
Collaborator

Works wonder 👍

@prakash1517
Copy link
Collaborator

Its look good I am also waiting for this. 👍

@nitinmadeshia
Copy link

It completely puzzles me, how can a human mind continuously move towards infinitesimally complex problem and provide such an elegant and simple solution. Cheers to the great mind.

@dpchn
Copy link
Collaborator

dpchn commented Feb 4, 2016

👍

@gaurav21r
Copy link
Member Author

@nitinmadeshia 😄 👍

@dpchn
Copy link
Collaborator

dpchn commented Feb 5, 2016

jequel={}

jequel.query = (obj,path) ->

destPath = 'obj'
path = _.values(path)
for i in path[0].split '/'
    destPath += "['#{i}']" if i isnt " "

return eval destPath

Try it. It will work but right now it will not work for "*" path

@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

5 participants