In "Node.js" the "module" pattern is implemented.

// ??? var fs = require('fs') // ???? var XXX = function(...) {...} module.exports.init = function( db ) { // Private member var YYY = function (...) {...} // Public member mod.ZZZ = function (...) {...} return mod } 

There was a problem in terminology, how to properly call the "scope" XXX , YYY , and ZZZ :

  • XXX - this function is visible YYY , ZZZ and is available for DI from the outside (rewire).
  • YYY - this function is visible only inside init . The narrowest area.
  • ZZZ - public method / function (public method / function)
  • Is this an attempt to translate some article? It is a little difficult without the context to understand what is required from the terminology. - Fedor Rusak
  • No, this is an attempt to name the terms to simplify communication - hellboy
  • Well, in an amicable way, there are no such special terms. Essentially distinguished variables are visible within the function and global. And the fact that links are preserved somewhere due to the closure mechanism does not create a separate type of scope. I understand the question correctly? - Fedor Rusak
  • function scope , module scope public scope - not? - hellboy
  • in the current standard, JS modules are a hack, such as wrapping a code into a circuit. If it does not confuse, and does not care how the language works, then you can choose any convenient terms. - Fedor Rusak

0