How to use the numberFormat function from underscore.string
Find comprehensive JavaScript underscore.string.numberFormat code examples handpicked from public code repositorys.
7 8 9 10 11 12 13 14 15 16 17
module.exports = function(app) { // Include string format helpers app.locals.num = function(num, digits) { var sigDigits = Number(digits); if (isNaN(sigDigits)) sigDigits = 2; return s.numberFormat(Number(num), sigDigits); }; app.locals.timeAgo = function(time) { return moment(time).fromNow(true);
4
4
0
68 69 70 71 72 73 74 75 76 77
let num = this.parseNumber(ev.target.value); ev.target.value = this.formatNumber(num); }, formatNumber(value) { return s.numberFormat(value, this.props.decimalDigits, ',', '.'); }, parseNumber(value) { if (_.isNumber(value)) {
0
3
0
+ 2 other calls in file
GitHub: Kiubi/alpha
57 58 59 60 61 62 63 64 65 66 67
if (bytes == 0) return '0 octets'; var k = 1024, dm = decimals || 2, sizes = ['octets', 'Ko', 'Mo', 'Go'], i = Math.floor(Math.log(bytes) / Math.log(k)); return _string.numberFormat(bytes / Math.pow(k, i), dm, ',', ' ') + ' ' + sizes[i]; } /** * Format float
0
1
0
+ 3 other calls in file
GitHub: Kiubi/alpha
21 22 23 24 25 26 27 28 29
selectPayload: function() { return _.map(this.toJSON(), function(item) { return { 'value': item.tax_id, 'label': _string.numberFormat(parseFloat(item.vat_rate), 2, ',', ' ') + ' %' }; }); }
0
1
0
GitHub: NyxLang/NyxLang
335 336 337 338 339 340 341 342 343 344
return new NyxString(s); } "number-format"(decimals) { decimals = decimalParameterToInt(decimals); const res = s.numberFormat(this.__value__, decimals); return new NyxString(res); } "numeric?"() {
0
0
0
+ 7 other calls in file
underscore.string.slugify is the most popular function in underscore.string (323 examples)