numbro
Version:
Format and manipulate numbers.
57 lines (55 loc) • 1.32 kB
JavaScript
/*!
* numbro.js language configuration
* language : English
* locale: South Africa
* author : Stewart Scott https://github.com/stewart42
*/
module.exports = {
languageTag: "en-ZA",
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: "R",
position: "prefix",
code: "ZAR"
},
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
}
}
};