0.0.2 • Published 7 years ago
ihgs v0.0.2
I HATE GETTERS AND SETTERS
ABOUT
WHY
Because I hate repeating code over and over again, and that is what happens with getters and setters when I am defining classes for my own projects.
HOW TO USE
PROPERTIES
They are self explanatory, name and defaultValue are mandatory properties and type is recommended.
[
{
name: 'myProp',
defaultValue: 'Hello World!',
type: 'String'
}
]
HOW TO INSTANCE A CLASS
As easy as it seems
class Person extends DefaultClass {
constructor() {
const properties = [{
name: 'name',
defaultValue: '',
type: 'String'
}, {
name: 'age',
defaultValue: 0,
type: 'Number'
}]
super(properties);
}
}
Now you can instance new Person()
and it will return the class with getters, setters and type validation.