Primap: Private Members WeakMap
Use weakmaps to provide truly private properties to your classes.
This is a very succint implementation and abstraction
Usage:
Import primap
in your class definition module and start using it. The important step is to bind
it to your object reference before setting any properties on _p()
:
// var _p = require('primap');; Class Hello { ; // important! // setting as property access from = from; // setting as params for dynamic prop names for example ; } { return from; } { return `Hello darling! I know your name is , I'm ` } // module.exports = Hello;;
Import your class somewhere else
// var Hello = require('./Hello');; const hello = 'John' 'Mary'; hello; // "Hello darling! I know your name is Mary, I'm John" hellofrom; // undefined