classprivates
v0.1.7
Published
Makes all class members (properties, methods, getters and setters) with a certain prefix (default is '_') private.
Downloads
4
Readme
classprivates
© Ironboy 2017, MIT licensed
What does it do?
Makes all class members (properties, methods, getters and setters) with a certain prefix (default is "_") private.
How?
Firstly define a class
class ClassName(){
// whatever methods, setters and getters
}
Then make members private
var classprivates = require('classprivates');
ClassName = classprivates(ClassName,[prefixString]);
This makes all properties, methods, getters and setters with a certain prefix (default is "_") private - that is non-reachable from outside the code in the class.
Lastly (and optionally)
Just if you are making a module from your class:
module.exports = ClassName;