Open jwerre opened 8 years ago
module.exports = function ordinal(num) { var suffix=["th","st","nd","rd"], val=num%100; return num+(suffix[(val-20)%10]||suffix[val]||suffix[0]); }; _.ordinal(1) // 1st _.ordinal(2) // 2nd _.ordinal(3) // 3rd _.ordinal(4) // 4th