get-exports-from-file

0.5.0 • Public • Published

get-exports-from-file

just a function used by vscode-exports-autocomplete

api is straighforward:

import getExportsFromFile from './index'
// make sure to use absolute paths, not relative paths
getExportsFromFile.es6('/some-js-file.js').then((result) = {
    result.exportsFromFile // array of objects, each object has a String `name` and Boolean `default` props
})
// second argument is a flag to signify you want to attempt to get CommonJS export
getExportsFromFile.cjs('/CJS.js', true).then((result) = {
    result.exportsFromFile // array of objects, each object has a String `name` and Boolean `default` props
})
 
 

Package Sidebar

Install

npm i get-exports-from-file

Weekly Downloads

2

Version

0.5.0

License

MIT

Last publish

Collaborators

  • capaj