Skip to content
This repository has been archived by the owner on Jul 13, 2020. It is now read-only.

Implement bulk export variation #387

Closed
wants to merge 2 commits into from
Closed

Implement bulk export variation #387

wants to merge 2 commits into from

Conversation

guybedford
Copy link
Member

Possible implementation of #386 pending format testing.


// export({name: value})
if (typeof name == 'object') {
for (var p in name)

Choose a reason for hiding this comment

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

Don't you need a hasOwnProperty check here?

Copy link
Member Author

Choose a reason for hiding this comment

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

Only if we expect to run in environments with Object.prototype extended with enumerable properties.

Choose a reason for hiding this comment

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

What about export(new MyObject), that has enumerable properties on its prototype. Won't this then copy those over to the module? I'm not to sure it will only receive plain objects, is all.

(If you extend Object.prototype I feel you should be on your own)

Copy link
Member Author

Choose a reason for hiding this comment

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

This API is defined to take instances of Object only from transpiler outputs and is independent of user code.

Copy link
Member Author

Choose a reason for hiding this comment

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

Specifically - Object or Module.

@guybedford
Copy link
Member Author

This is now tested and working against Traceur at google/traceur-compiler#1957.

@guybedford
Copy link
Member Author

Merged.

@EisenbergEffect
Copy link

Thanks Guy! Hopefully we can get the other transpiler implementors to move quickly.

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.

3 participants