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
- Host: GitHub
- URL: https://github.com/capaj/get-exports-from-file
- Owner: capaj
- License: mit
- Created: 2016-12-01T08:00:43.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2023-01-20T21:42:57.000Z (over 3 years ago)
- Last Synced: 2024-04-26T10:22:06.947Z (about 2 years ago)
- Topics: es6, javascript
- Language: JavaScript
- Size: 58.6 KB
- Stars: 2
- Watchers: 3
- Forks: 3
- Open Issues: 1
-
Metadata Files:
- Readme: readme.md
- License: LICENSE
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
})
```