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

Improve finding nodes #26

Open
cpojer opened this issue Jul 27, 2015 · 2 comments
Open

Improve finding nodes #26

cpojer opened this issue Jul 27, 2015 · 2 comments

Comments

@cpojer
Copy link
Contributor

cpojer commented Jul 27, 2015

We are discussing different ways to improve finding nodes. For now, we'll attempt to build a simple parse API that will allow us to pass a JS pattern into find and uses the existing pattern matching to match things. Let's see how far we take this.

j.find(pattern`var $ = require('merge');`)

// becomes
j.find(j.VariableDeclaration, {
  init: {
    type: 'Identifier',
    name: undefined
  }
});

Alternative approaches would be to use CSS selectors, because they are made to query trees. Another solution would be to extend babylon/acorn but that seems hard to maintain over time.

@cpojer cpojer self-assigned this Jul 27, 2015
@hzoo
Copy link
Contributor

hzoo commented Aug 7, 2015

Yeah, maybe some inspiration from something similar like http://www.graspjs.com/?

@fkling
Copy link
Contributor

fkling commented Aug 7, 2015

@hzoo: That's exactly what I had in mind. I came across this project last year but forgot its name and couldn't find it anymore :(

It would be cool if we could simply use it.

@cpojer cpojer removed their assignment Apr 15, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants