[英]Formatting values fetched from dirty datastore
Is it possible to format data which is fetched from dirty? 是否可以格式化从脏文件中获取的数据? For example, 83647 to be formatted as 83,647.
例如,将83647格式化为83,647。 I have the following code for unformatted data:
我有以下代码用于未格式化的数据:
db.on('load', function() {
db.set('john', {completed: '83647'});
console.log('John's completed tasks are: %s', db.get('john').completed);
});
Numeral.js is what you are looking for.. Numeral.js是您正在寻找的..
example: 例:
numeral(12345).format('0,0'); // -> 12,345
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.