liveBook · Manning

Module.exports

As explained in Secrets of the JavaScript Ninja, Second Edition

The CommonJS property whose assigned value is exposed as a module's public API.

In CommonJS, `module.exports` names the value a module exposes as its public API. A clear interface lets other code use the module’s functionality while keeping implementation details hidden and protected from unwanted changes. section 11.1

How Secrets of the JavaScript Ninja, Second Edition covers it

How deep it goes
Frames module interfaces and hidden internals, but does not detail `module.exports` assignment mechanics.
What you can do after
Understand how a CommonJS module’s public interface separates usable functionality from hidden implementation details.
How it connects
Connects CommonJS with JavaScript modules, objects, closures, immediate functions, and AMD.

Related concepts

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.