tcharlat/raft

Chain methods on models

LancelotP opened this issue · 0 comments

For example we can run :

var Model = new factory(fooModel);

Mode.isValidName().isValidAge().toJSON()
.then(function (json) {
    return json
}
.catch(function (err) {
    // any error throw by is methods or toJSON
    throw err
}

This allow to chain and execute several methods without having to implement multiple promises.