npm.io
1.0.1 • Published 8 years ago

@suchipi/esquery

Licence
BSD-3-Clause
Version
1.0.1
Deps
1
Size
91 kB
Vulns
0
Weekly
0
Stars
887

This is a fork of ESQuery that lets you configure the method used to get keys for a given node, eg:

const customAst = {
  type: "Foo",
  children: [
    {
      type: "Bar",
      value: 5
    }
  ]
};

const esquery = require("esquery").configure({
  getKeys(node) {
    return Object.keys(node);
  }
});

esquery.query(customAst, "Foo > Bar[value=5]"); // [ { type: "Bar", value: 5 } ]

Keywords