Skip to content

rohmanhm/simplify-number

Repository files navigation

Simplify Number

Greenkeeper badge Build Status

Simplify number

How to install

  • via npm:
npm install --save simplify-number
  • via yarn:
yarn add simplify-number

Usage

// ES6+ Babel
// Typescript
import SimplifyNumber from 'simplify-number'
// CommonJS
const SimplifyNumber = require('simplify-number').default

console.log(SimplifyNumber(1000)) // it's return 1k

API

SimplifyNumber(number, config)
  • number: type number. example: 1000
  • config: type object.
    • abbrev: type array. default: ['k', 'm', 'b', 't']
    • decimal: type number. default: 2

LINCESE

MIT Copyright (c) 2018 - MH Rohman Masyhar