Data Hiding, Instances, and Better Testing with JS Factories and Closures
I’ve been working a lot with NodeJS modules but more these days it’s ES6 modules usually when I design JS applications. The problem with this approach is that ES6 modules are by nature a singleton. They do hide state in terms of the fact that variables and functions inside an ES6 module are local to the module (that’s why you export the ones you do want as part of…