项目作者: mayeedwin

项目描述 :
Prune Number Counters
高级语言: JavaScript
项目地址: git://github.com/mayeedwin/pruned.git
创建时间: 2020-04-20T19:35:57Z
项目社区:https://github.com/mayeedwin/pruned

开源协议:MIT License

下载


Prune Number Counters

Basically, prune a.k.a abbreviate number counters for example 1,250,000 to 1.3M

Install Pruned

  1. npm i pruned

Import pruned in your react app

  1. import pruned from 'pruned';

Require the pruned package

  1. const pruned = require('pruned');

Pass in the number value

  1. let newRating = pruned.Number(value);

Examples…

  1. let value = 5300;
  2. let likes = pruned.Number(value); // Output : 5.3K