export-main
v0.0.1
Published
A function to export a package as module.exports and exports.default at the same time.
Downloads
8
Readme
A simple function exportMain(module, packageToExport) : packageToExport.
The function does just module.exports.default = module.exports = packageToExport.
⚠️ The function assign to the package's default field the package itself. Then:
- The
defaultfield must be writable and not already used by another value, otherwise the value will be lost. - It creates a circle ref
package.default = package(can be problem if you wish to serialize your package). - Doesn't work with primitives (
String,Number&Boolean).
