Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Find nested exports when inside ternary
Some libraries (like airbnb-prop-types [1]), like to export different files depending the current NODE_ENV. Export statements can then look something like: module.exports = process.env.NODE_ENV === 'production' ? require('a') : require('b'); In most cases, the two alternatives will have the same structure, so finding named exports in either of the two should be fine. I've made it so that we always pick the first alternative (the `consequent`) in ternary exports. There are of course other ways of conditionally exporting things. For now I'm only dealing with ternaries, we can worry about other styles when we have those use-cases. Fixes #411 [1] https://unpkg.com/airbnb-prop-types@2.5.4
- Loading branch information