1.1.4 • Published 6 years ago

builder-pattern-es6 v1.1.4

Weekly downloads
3
License
ISC
Repository
github
Last release
6 years ago

builder-pattern-es6

Create a builder pattern for ES6 classes.

Installation

npm i builder-pattern-es6
yarn add builder-pattern-es6

Usage

const builderES6 = require("builder-pattern-es6");

class Pizza {
  get name() {
    return this._name;
  }

  set name(value) {
    this._name = value;
  }

  get meatQuantity() {
    return this._meatQuantity;
  }

  set meatQuantity(value) {
    this._meatQuantity = value;
  }

  get withOregano() {
    return this._withOregano;
  }

  set withOregano(value) {
    this._withOregano = value;
  }
}

builderES6(Pizza);

const pizza = Pizza.Builder()
  .name("Capricciosa")
  .meatQuantity(100)
  .withOregano(true)
  .build();
console.log(pizza);
// Pizza { _name: 'Capricciosa', _meatQuantity: 100, _withOregano: true }

License

This project is licensed under the MIT License - see the LICENSE file for details

1.1.4

6 years ago

1.1.3

6 years ago

1.1.2

6 years ago

1.1.11

6 years ago

1.0.9

6 years ago

1.0.8

6 years ago

1.0.7

6 years ago

1.0.6

6 years ago

1.0.5

6 years ago

1.0.4

6 years ago

1.0.3

6 years ago

1.0.2

6 years ago

1.0.10

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago