43ffb21446f2aa21723246f15790c3ae9fc5d1e6
[platform/framework/web/crosswalk-tizen.git] /
1
2
3     /**
4      * Returns "nth" of number (1 = "st", 2 = "nd", 3 = "rd", 4..10 = "th", ...)
5      */
6     function nth(i) {
7         var t = (i % 100);
8         if (t >= 10 && t <= 20) {
9             return 'th';
10         }
11         switch(i % 10) {
12             case 1:
13                 return 'st';
14             case 2:
15                 return 'nd';
16             case 3:
17                 return 'rd';
18             default:
19                 return 'th';
20         }
21     }
22
23     module.exports = nth;
24
25