Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ five.telugu() // ఐదు
five.thai() // ห้า
five.turkish() // beş
five.ukrainian() // п’ять
five.urdu() // پانچ
five.welsh() // pump
```

Expand Down Expand Up @@ -197,6 +198,9 @@ five.guys(); // '🍔'
```javascript
five.euro(); // '5€'
five.dollar(); // '$5'
five.rupee('pakistani'); // '5 Rs.'
five.rupee('indian'); // '₹ 5'
five.rupee(); // '5 Rs.' for the default case
```


Expand Down
9 changes: 9 additions & 0 deletions five.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@
five.turkish = function() { return 'beş'; };
five.thai = function() { return 'ห้า'; };
five.ukrainian = function() { return 'п’ять'; };
five.urdu = function() {return 'پانچ';};
five.welsh = function() { return 'pump'; };

five.morseCode = function() { return '.....'; };
Expand Down Expand Up @@ -196,6 +197,14 @@

five.dollar = function() { return '$5' };

five.rupee = function(type) {
switch (type) {
case 'pakistani': return '5 Rs.';
case 'indian': return '₹ 5';
default: return '5 Rs.';
}
};

five.rot = function(word) {
if(typeof(word) != 'string') {
return word;
Expand Down
5 changes: 5 additions & 0 deletions test.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ assert.equal('ఐదు', five.telugu(), 'A telugu five should be ఐదు');
assert.equal('ห้า', five.thai(), 'A thai five should be ห้า');
assert.equal('beş', five.turkish(), 'A turkish five should be beş');
assert.equal('п’ять', five.ukrainian(), 'A ukrainian five should be п’ять');
assert.equal('پانچ', five.urdu(), 'An urdu five should be پانچ');

assert.equal('.....', five.morseCode(), 'A five in morse code should be .....');
assert.equal('10', five.base(5), 'A quinary five should be 10');
Expand Down Expand Up @@ -142,6 +143,10 @@ assert.equal('5€', five.euro());

assert.equal('$5', five.dollar());

assert.equal('5 Rs.', five.rupee('pakistani'));
assert.equal('₹ 5', five.rupee('indian'));
assert.equal('5 Rs.', five.rupee());

assert.equal('5678901234', five.rot('0123456789'), 'Numbers should be rotated');
assert.equal('fghijklmnopqrstuvwxyzabcde', five.rot('abcdefghijklmnopqrstuvwxyz'), 'Small letters should be rotated');
assert.equal('FGHIJKLMNOPQRSTUVWXYZABCDE', five.rot('ABCDEFGHIJKLMNOPQRSTUVWXYZ'), 'Capital letters too');
Expand Down