ES6 Modules in 2 Minutes

Module are good. You should use them. Here's how:

Given: AThing.js

export function doAThing() {...}

export default {  
  doADifferentThing: () => {...},
  someData: 17
}

Things you can do:

// Gets the default export
import AThing from './AThing'  
AThing.doADifferentThing()  
AThing.someData  
// Gets a normal export by name
import {doAThing} from './AThing'  
doAThing()  

Things you can't do:

// Can't destructure default export inline
import {doADifferentThing, doAThing} from './AThing'  
// Function `doAthing` is not available in the default export
import AThing from './AThing'  
AThing.doAThing();  

Hope this helps!