1.0.2 • Published 10 years ago
quenya-estree v1.0.2
Quenya ESTree Enhancer
Uses an ESTree-compatible parser to enhance Quenya doc objects with the JS AST node their context points to.
npm install quenya-estreeUsage
const quenyaESTree = require('quenya-estree')
quenyaESTree([quenya objects...], options)
.catch(err => void console.error(err))
.then(docs => {
docs.forEach(doc => void console.log(doc))
// ...
})Options
discard(boolean, defaults tofalse): Iftrue, return only objects for which an AST node was found; iffalse, pass-through all others too.parser(function, required): Will be passed a path, should return a Promise that resolves to the AST or an error.filter(function, defaults to checking the extension matches.jsand the doc has a non-nullcontext): Will be passed a path, should return truthy if the described file should be parsed and falsy otherwise.
Parsers
There are five already-Promisified parsers available (but of course you may plug in your own):