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

More Generic selectors #43

Open
BebeSparkelSparkel opened this issue Feb 21, 2018 · 0 comments
Open

More Generic selectors #43

BebeSparkelSparkel opened this issue Feb 21, 2018 · 0 comments

Comments

@BebeSparkelSparkel
Copy link

I am trying to query the remove properties in this data object and then remove them.
Does AST-query allow more generic queries like (just an example)
module.exports = Object(\.+\g, Array(Object(remove)))

module.exports = {
  form0: [
    {
      remain: "remain val",
      remove: "remove val",
    },
    {
      remove: "remove val",
      remain: "remain val",
    },
  ],
  form1: [
    {
      remain2: "remain2 val",
      remain1: "remain1 val",
    }
  ],
}

Result once all remove keys are removed

module.exports = {
  form0: [
    {
      remain: "remain val",
    },
    {
      remain: "remain val",
    },
  ],
  form1: [{
    remain2: "remain2 val",
    remain1: "remain1 val",
  }],
}
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

1 participant