1.0.0 • Published 3 years ago

@bakeryjs/builder v1.0.0

Weekly downloads
-
License
MIT
Repository
github
Last release
3 years ago

bakeryjs/builder

Generic Builder pattern implementation to simplify the object creation process in JavaScript.

Installation

Install library via npm:

$ npm install @bakeryjs/builder

How to use

const prototype = { name: '', age: 0 };
const user = Builder(prototype)
  .name('John')
  .age(12)
  .build(); // { name: 'John', age: 12 }

It is possible to use Builder as with object as with class or function.

Note: keyword build reserved by Builder and cannot be used as a variable name in prototype object.