An open API service indexing awesome lists of open source software.

https://github.com/capaj/get-exports-from-file

parses a javascript file and outputs a list of exported components
https://github.com/capaj/get-exports-from-file

es6 javascript

Last synced: 12 months ago
JSON representation

parses a javascript file and outputs a list of exported components

Awesome Lists containing this project

README

          

## get-exports-from-file

just a function used by [vscode-exports-autocomplete](https://github.com/capaj/vscode-exports-autocomplete)

api is straighforward:
```javascript
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
})

```