Two ES6 features that help with CommonJS modules
CRANK

[2017-03-26]dev, javascript, esnext, commonjs, nodejsEven without ES modules, ES6 makes Node.js a joy to use. Two ES6 features eliminate some of the redundancy of CommonJS syntax.Importing and destructuring  Destructuring can make importing more concise.Without destructuring:const func = require('lib').func; With destructuring:const {func} = require('lib'); Exporting and property value shorthands  Exporting can profit from property value shorthands.Without property value shorthands:function foo() { ··· } function bar() { ··· } function baz() { ··· } module.exports = { foo: foo, bar: bar, baz: baz, }; Using property value shorthands:function foo() { ··· } function bar() { ··· } function baz() { ··· } module.exports = { foo, bar, baz }; Over the years, I’ve tried various other ways of being less redundant when exporting, but this approach seems cleanest to me.Further reading

2ality.com
Related Topics: JavaScript Node.js