@spalger/kibana
Version:
Kibana is an open source (Apache Licensed), browser based analytics and search dashboard for Elasticsearch. Kibana is a snap to setup and start using. Kibana strives to be easy to get started with, while also being flexible and powerful, just like Elastic
21 lines (17 loc) • 539 B
JavaScript
define(function (require) {
// adopted from http://stackoverflow.com/questions/3109978/php-display-number-with-ordinal-suffix
var _ = require('lodash');
return function addOrdinalSuffix(num) {
return num + '' + suffix(num);
};
function suffix(num) {
var int = Math.floor(parseFloat(num));
var hunth = int % 100;
if (hunth >= 11 && hunth <= 13) return 'th';
var tenth = int % 10;
if (tenth === 1) return 'st';
if (tenth === 2) return 'nd';
if (tenth === 3) return 'rd';
return 'th';
}
});