Methods should be chainable
manthanhd opened this issue · comments
Manthan Dave commented
// proposed
new Bot().train(topic, sentence).addSkill(skill).resolve(....)
// current
var bot = new Bot();
bot.train(topic, sentence);
bot.addSkill(skill);
bot.resolve(....);
Rafael Klaessen commented
Isn't it just enough to add return this;
in each method? It will return the original Bot object so that all other methods are still defined.
Manthan Dave commented
@rafaelklaessen you are right. See pull request #17 for updates.
Manthan Dave commented
Closing as @marekhakala's merge request has been merged.