private-props
v0.1.1
Published
Private property simulation for javascript
Downloads
1
Maintainers
Readme
private-props
Simulation of private property for javascript (though private property isn't that needed in javascript), this module would probably be useless.
Installation
npm install -S private-props
Usage
// sample usage on how to use this module
let props = require('private-props')
class Foo {
constructor() {
/** now this properties won't be accessible to the outside world */
props(this).width = 100
props(this).height = 100
/** this is publicized properties */
this.weight = 50
}
// accessing property from within class
getWidth() {
return props(this).width
}
}
module.exports = Foo
Issues
- somehow the content of the class is visible if you supply an instantiated version of the class