numbro
Version:
Format and manipulate numbers.
60 lines (58 loc) • 1.46 kB
JavaScript
/*!
* numbro.js language configuration
* language : English
* locale: United Kingdom of Great Britain and Northern Ireland
* author : Dan Ristic : https://github.com/dristic
*/
module.exports = {
languageTag: "en-GB",
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: "GBP"
},
currencyFormat: {
thousandSeparated: true,
totalLength: 4,
spaceSeparated: false,
spaceSeparatedCurrency: false,
average: true
},
formats: {
fourDigits: {
totalLength: 4,
spaceSeparated: false,
average: true
},
fullWithTwoDecimals: {
output: "currency",
thousandSeparated: true,
spaceSeparated: false,
mantissa: 2
},
fullWithTwoDecimalsNoCurrency: {
mantissa: 2,
thousandSeparated: true
},
fullWithNoDecimals: {
output: "currency",
thousandSeparated: true,
spaceSeparated: false,
mantissa: 0
}
}
};