Re: Proposal: importing selected chucks of a module into an object

2016-05-25 Thread Isiah Meadows
Even with some larger libraries, you can do things like this: ```js // small modules import xmlParse from 'xml/parse'; import xmlCreate from 'xml/create'; import xmlSandwich from 'xml/sandwich'; import jsonParse from 'json/parse'; import jsonCreate from 'json/create'; import jsonBacon from

Re: Proposal: importing selected chucks of a module into an object

2016-05-25 Thread Norbert de Langen
Small modules are great, especially for creators. I’m onboard with small-modules being the default and recommended way of doing things. But.. I think history has shown that there is a use-case and a place in the world for larger composed modules. Take a look at lodash or jQuery for example. From

Re: Proposal: importing selected chucks of a module into an object

2016-05-24 Thread Jordan Harband
This is usually part of the reason why small modules are recommended, rather than large object bags of things (including many named exports). Have you considered putting each thing you want to import as the default export of a separate file? On Tue, May 24, 2016 at 9:20 PM, Norbert de Langen <

Re: Proposal: importing selected chucks of a module into an object

2016-05-24 Thread Norbert de Langen
I think there’s a preference reason for this but also optimization reasons. For humans it becomes crystal clear exactly what parts are dependent on. I personally like this. When importing the entire module the module code needs to be run to figure out what parts are not needed. Eliminating the

Re: Proposal: importing selected chucks of a module into an object

2016-05-24 Thread Tab Atkins Jr.
On Tue, May 24, 2016 at 11:59 AM, Norbert de Langen 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 >

Proposal: importing selected chucks of a module into an object

2016-05-24 Thread Norbert de Langen
# importing selected chucks of a module into an object Modules are always imported into the root scope of the imported file. But in some cases it can be desirable to load modules into a namespace-object. Especially when importing a large number of parts/chunks from a module creating a