Sometimes I've seen people use module.exports.instance
in their code (example). How does this differ from module.exports
?
The literal difference is that module.exports.instance
is a property of the object referenced by module.exports
.
Why use a property named instance
? One possibility is an application of the Singleton Pattern to resolve issues with circular dependencies among modules.