dojo / core

:rocket: Dojo 2 - language helpers and utilities.
http://dojo.io
Other
213 stars 62 forks source link

Adding loader helper to load ES modules, issue #210 #270

Closed rorticus closed 7 years ago

rorticus commented 7 years ago

Adding a helper to make loading ES modules easier. This is based on @matt-gadd 's suggestion in https://github.com/dojo/core/pull/262

import load, { useDefault } from '@dojo/core/load';

load('es-module').then(useDefault).then([module] => { /* do something */ });

useDefault will check if a module has the __esModule meta data and if so, return the module's default value.

Can also be used on an individual module,

load('a', 'b').then([a, b] => [useDefault(a), b]).then([moduleA, moduleB] => { /* do something */ });

Resolves #210

codecov-io commented 7 years ago

Current coverage is 83.01% (diff: 75.00%)

Merging #270 into master will decrease coverage by 12.22%

@@             master       #270   diff @@
==========================================
  Files            34         34          
  Lines          1805       1813     +8   
  Methods          19         19          
  Messages          0          0          
  Branches        350        353     +3   
==========================================
- Hits           1719       1505   -214   
- Misses           27        230   +203   
- Partials         59         78    +19   

Powered by Codecov. Last update 2f2d3e8...474f90a

rorticus commented 7 years ago

Added support for iterables!