Exporting a Module Instance Object
# Sam Tobin-Hochstadt (12 years ago)
Yes, this should work fine.
Yes, this should work fine.
On Mon, Dec 9, 2013 at 8:59 AM, Kevin Smith <zenparsing at gmail.com> wrote:
> Is it possible to export a module instance object?
>
> module x from "x";
> export { x };
>
> I believe this should be allowed. I'm not aware of a technical reason why
> it shouldn't, and not allowing it would restrict some valid design options.
>
> For instance, within a package I might have a module which exports a set of
> functions [1]. I want to expose those functions as a part of the package
> API, but "under" an exported name [2].
>
> Thanks!
>
> [1]: https://github.com/zenparsing/zen-bits/blob/master/src/ConsoleStyle.js
> [2]: https://github.com/zenparsing/zen-bits/blob/master/src/main.js
>
>
> _______________________________________________
> es-discuss mailing list
> es-discuss at mozilla.org
> https://mail.mozilla.org/listinfo/es-discuss
>
Is it possible to export a module instance object?
I believe this should be allowed. I'm not aware of a technical reason why it shouldn't, and not allowing it would restrict some valid design options.
For instance, within a package I might have a module which exports a set of functions 1. I want to expose those functions as a part of the package API, but "under" an exported name 2.
Thanks!
Is it possible to export a module instance object? module x from "x"; export { x }; I believe this should be allowed. I'm not aware of a technical reason why it shouldn't, and not allowing it would restrict some valid design options. For instance, within a package I might have a module which exports a set of functions [1]. I want to expose those functions as a part of the package API, but "under" an exported name [2]. Thanks! [1]: https://github.com/zenparsing/zen-bits/blob/master/src/ConsoleStyle.js [2]: https://github.com/zenparsing/zen-bits/blob/master/src/main.js -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20131209/400f3554/attachment.html>