numbro
Version:
Format and manipulate numbers.
57 lines (55 loc) • 1.31 kB
JavaScript
/*!
* numbro.js language configuration
* language : English
* locale: Australia
* author : Benedikt Huss : https://github.com/ben305
*/
module.exports = {
languageTag: "en-AU",
delimiters: {
thousands: ",",
decimal: "."
},
abbreviations: {
thousand: "k",
million: "m",
billion: "b",
trillion: "t"
},
ordinal: number => {
let b = number % 10;
return (~~(number % 100 / 10) === 1) ? "th" : (b === 1) ? "st" : (b === 2) ? "nd" : (b === 3) ? "rd" : "th";
},
currency: {
symbol: "$",
position: "prefix",
code: "AUD"
},
currencyFormat: {
thousandSeparated: true,
totalLength: 4,
spaceSeparated: true,
spaceSeparatedCurrency: true,
average: true
},
formats: {
fourDigits: {
totalLength: 4,
spaceSeparated: true,
average: true
},
fullWithTwoDecimals: {
thousandSeparated: true,
mantissa: 2
},
fullWithTwoDecimalsNoCurrency: {
mantissa: 2,
thousandSeparated: true
},
fullWithNoDecimals: {
output: "currency",
thousandSeparated: true,
mantissa: 0
}
}
};