Skip to content

Latest commit

 

History

History
21 lines (16 loc) · 542 Bytes

README.md

File metadata and controls

21 lines (16 loc) · 542 Bytes

eq-chainify

A Builder library that provides a simple way to create complex objects using chaining pattern.

##Example

     var myCar = makeCar().color('red').brand('nissan');

    myCar.specifications(); // { color: 'red', brand: 'nissan' }

    function makeCar() {
        var car = {};
        return chainify
            .obj(car)
            .field('color', 'white') // by default all cars are white
            .field('brand')
            .method('switchEngine', () => car['on'] = !car['on'])
            .value();
    }