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

README.md doesn't explain what 'something' is #2

Open
steve-taylor opened this issue Apr 11, 2017 · 1 comment
Open

README.md doesn't explain what 'something' is #2

steve-taylor opened this issue Apr 11, 2017 · 1 comment

Comments

@steve-taylor
Copy link

steve-taylor commented Apr 11, 2017

var describe = require('jscodeshift-helper').describe;

...

describe(something); // logs helpful info to the console

But what is something? I was really hoping jscodeshift-helper would help me get started.

I tried this:

module.exports = function(file, api, options) {
    const root = api.jscodeshift(file.source);
    describe(root);
    return null;
}

but it just gives me some basic API docs. I got the impression from the README that this would explain the syntax tree recursively, so I tried this:

module.exports = function(file, api, options) {
    const root = api.jscodeshift(file.source);
    describe(root.childNodes);
    return null;
}

but I just got this:

This is a generic object.

{ [Function: typedMethod]
  typedRegistrations: 
   { JSXElement: [Function],
     Expression: false,
     Pattern: false,
     Node: false,
     Printable: false } }

As someone who is trying to figure out how to use jscodeshift, this doesn't tell me anything at all.

@reergymerej
Copy link
Owner

Thanks for the feedback @steve-taylor. As I recall, something was supposed to be the result of a query: a node, collection, or path. There's no recursion.

I used this while I was exploring jscodeshift and it helped me. If you'd like to submit a PR to enhance it, that would be excellent.

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