Created
April 12, 2017 15:21
-
-
Save agjs/7cdede0ce84a2ad52ed7d6d04a386b46 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Fluent api | |
function Chai() {} | |
Chai.prototype.expect = function(number) { | |
this.number = number; | |
return this; | |
}; | |
Chai.prototype.increment = function() { | |
this.number += 1; | |
return this; | |
}; | |
Chai.prototype.decrement = function() { | |
this.number -= 1; | |
return this; | |
}; | |
Chai.prototype.addTo = function(num) { | |
this.number -= num; | |
return this; | |
}; | |
var chai = new Chai(1); | |
chai.expect(5).increment(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment