Modules and Namespaces
Module Facade
Expose a small public surface for related operations.
Module Facade
module_facade.js
const raw = "7";
const output = {
parse(text) {
return Number(text);
},
format(value) {
return "value=" + value;
},
}.format(Number(raw));
console.log("raw=" + raw);
console.log("output=" + output);
module-facade
A facade exposes the few operations callers should use. Even with an object namespace, keep the public surface small and named clearly.