diff --git a/README.md b/README.md index addc66f6..c017e259 100644 --- a/README.md +++ b/README.md @@ -170,6 +170,7 @@ five.discography(); //['5ive', 'Invincible', 'Kingsize'] five.singles(); //['Slam Dunk (Da Funk)', 'When the Lights Go Out', 'Got the Feelin\'', 'Everybody Get Up', 'It\'s the Things You Do', 'Until the Time Is Through', 'If Ya Gettin\' Down', 'Keep On Movin\'', 'Don\'t Wanna Let You Go', 'We Will Rock You', 'Let\'s Dance', 'Closer to Me', 'Rock the Party', 'I Wish It Could Be Christmas Everyday'] five.famous(); // ['Julian', 'Dick', 'George', 'Anne', 'Timmy'] five.fiveFiveFive(); // 'Interstella 5555: The 5tory of the 5ecret 5tar 5ystem' +five.five().five().five().five().toString(); // '55555' ``` ##### Rotation diff --git a/five.js b/five.js index 90507e66..9b06ccd8 100755 --- a/five.js +++ b/five.js @@ -220,6 +220,23 @@ five.bucks = function() { return '$' + five() + '.00'; }; + five.five = function () { + var self = { + total: "55", + }; + + function five() { + self.total += "5"; + return self; + } + + self.five = five; + self.toString = function () { + return self.total + }; + return self; + }; + five.valueOf = five; if(typeof module !== 'undefined' && module.exports) { diff --git a/test.js b/test.js index 63ee6cc8..d80ab9ef 100755 --- a/test.js +++ b/test.js @@ -154,6 +154,10 @@ assert.equal(five - five, 0); assert.equal((five / five) * (five), five); assert.equal(120, five.factorial()); +assert.equal(five.five().toString(), "55", "Five and five makes fifty-five"); +assert.equal(five.five().five().toString(), "555", "Three fives makes five hundred and fifty-five"); +assert.equal(five.five().five().five().toString(), "5555", "Four fives makes five thousand, five hundred and fifty-five"); + var fiveEmitter = five.emitter(); var emitterTested = false;