Skip to content
This repository has been archived by the owner on Aug 4, 2021. It is now read-only.

Support a namedExports false option for dataToEsm #32

Merged
merged 4 commits into from
May 21, 2018
Merged

Conversation

guybedford
Copy link
Contributor

This is useful for having a flag to entirely enable/disable named exports from data imports (currently named exports should be disabled for strict NodeJS compatibility with the work-in-progress implementation).

Copy link
Member

@lukastaegert lukastaegert left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a minor comment, looks good!

src/dataToEsm.js Outdated
@@ -44,6 +44,9 @@ export default function dataToNamedExports (data, options = {}) {
const _ = options.compact ? '' : ' ';
const n = options.compact ? '' : '\n';
const declarationType = options.preferConst ? 'const' : 'var';

if (options.namedExports === false || typeof data !== 'object' || Array.isArray(data))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we actually allow for non-object types to be passed here, we should add a check for null as well.

@guybedford
Copy link
Contributor Author

Thanks @lukastaegert. Sure, I've pushed the update. Please also check the null PR here too.

@lukastaegert lukastaegert merged commit eea7d7e into master May 21, 2018
@lukastaegert lukastaegert deleted the namedExports branch May 21, 2018 17:19
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants