ModuleImport

Russell Leggett russell.leggett at gmail.com
Fri Jun 27 00:44:26 PDT 2014


On Fri, Jun 27, 2014 at 3:41 AM, Michał Gołębiowski <m.goleb at gmail.com>
wrote:

> On Thu, Jun 26, 2014 at 4:50 PM, Russell Leggett <
> russell.leggett at gmail.com> wrote:
>>
>>
>>     //import a single named export
>>     import foo from "bar";
>>
>>     //import multiple named exports
>>     import foo, baz from "bar";
>>
>>     //alias an imported named export
>>     import foo as fooAlias from "bar";
>>
>>     //import the module
>>     import "bar" as bar;
>>
>
> That would put a lot of Node modules exporting a single object/function at
> a disadvantage. Compare:
> ```js
> var mkdr = require('mkdirp');
> ```
> to:
> ```js
> import mkdirp as mkdr from mkdirp;
> ```
>
> I like that the most common module usage can be done simpler.
>
>
No, that example would be:

    import "mkdirp" as mkdir;

Its actually shorter than node.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20140627/52a15a89/attachment.html>


More information about the es-discuss mailing list