Rexport all features from one module to another - node.js
How to export all features of one module via another. Something like in the pseudocode below:
exports.func1 = ... exports.func2 = ... exports.func2 = ...
one = require 'one.js' exports = exportallfrom(one)
two = require 'two.js' two.func1() two.func2() two.func3()
You can have two inherit from one, using Object.create() to establish a prototype chain between them:
module.exports = exports = Object.create require './one.js' # ...
Or, you can simply iterate over one's properties, copying their values:
one = require './one.js' Object.keys(one).forEach (key) -> exports[key] = one[key] # ...