@sanghak/dokdo
v1.0.1
Published
javascript class builder
Downloads
8
Readme
Javascript class builder
like lombok
Install
npm install @sanghak/dokdo
usage
const { Builder } = require('@sanghak/dokdo');
class User extends Builder(class {
constructor(builder = {}) {
this.firstName = builder.firstName;
this.lastName = builder.lastName;
this.email = builder.email;
this.money = builder.money;
}
getName() {
return `${this.firstName}, ${this.lastName}`
}
static dummy() {
return "dummy";
}
}) {}
const user = new User.Builder()
.firstName('sanghak')
.lastName('lee')
.email('[email protected]')
.money(1000000000)
.build();
const user = new User('sanghak', 'lee', '[email protected]', 1000000000);
const user = new User({
firstName: 'sanghak',
lastName: 'lee',
email: '[email protected]',
money: 1000000000
});
user.getName() // return "sanghak, lee"
User.dummy() // return "dummy"