Proposal: importing selected chucks of a module into an object

Tab Atkins Jr. jackalmage at gmail.com
Tue May 24 19:06:19 UTC 2016


On Tue, May 24, 2016 at 11:59 AM, Norbert de Langen
<Norbert.de.Langen at macaw.nl> wrote:
> It would be nice to have this option:
>
> ```
> import { parse } as xmlLib from 'xml-lib';
> import { parse } as jsonLib from 'json-lib';
> import { parse } as htmlLib from 'html-lib';
>
> // usage
> xmlLib.parse();
> jsonLib.parse();
> htmlLib.parse();
> ```

This begs the question, tho - why do you only need to import selected
chunks? If you're pulling in the module as a namespace object, how
does having the *rest* of the module available harm you?

~TJ


More information about the es-discuss mailing list