In CommonJS, `exports` initially references a module’s export object and can define members of the module’s interface. Modular interfaces expose functionality while keeping implementation details hidden. section 11.1
Exports
A CommonJS variable that initially references a module's export object and can be used to define exported members.
How Secrets of the JavaScript Ninja, Second Edition covers it
- How deep it goes
- Identifies `exports` as a CommonJS mechanism but does not detail its mechanics or usage patterns.
- What it assumes
- Assumes familiarity with pre-ES6 JavaScript and builds on objects, closures, and immediate functions.
- How it connects
- Connects CommonJS with JavaScript objects, closures, immediate functions, and AMD modularization.
Related concepts
- module.exportsequivalent to · module.exports is the CommonJS property whose assigned value is exposed to other modules when they require the module.
- export methodcontrasts with · An export method is an interface element that makes data or functionality available to external consumers or systems.
- exportalternative to · An export is a JavaScript module declaration that makes bindings available to other modules.
This explainer was generated by Manning's knowledge graph from the text of Secrets of the JavaScript Ninja, Second Edition. The section links point to the parts of the book it draws on.
