Big News: Socket raises $60M Series C at a $1B valuation to secure software supply chains for AI-driven development.Announcement
Sign In

z-number-format

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

z-number-format

format number [

latest
Source
npmnpm
Version
2.0.4
Version published
Weekly downloads
76
52%
Maintainers
1
Weekly downloads
 
Created
Source

z-number-format Downloads Version License

Install

npm install z-number-format --save

params

ParamOptionsDefaultDescription
numbernumber string or numbernonewhich number need to format
typeOne of ['thousand', 'lakh', 'wan']thousandDefine the thousand grouping style, It support three types. thousand style (thousand) : 123,456,789, indian style (lakh) : 12,34,56,789, chinese style (wan) : 1,2345,6789
separatorseparator,Sets the thousands/wan/laxh separator.

import

// es6 module
import numberFormat from 'z-number-format';

// node module
var numberFormat = require('z-number-format');

// cdn Available on unpkg or 74b
<script src="https://unpkg.com/z-number-format@2.0.3/src/index.js"></script> 

<script src="https://74b.cc/js/zNumberFormat.js"></script> 

typescript

Supports typescript

use it in website

declare global function numberFormat

<script src="https://74b.cc/js/zNumberFormat.js"></script> 
numberFormat(123456)    

Examples

var numberFormat = require('z-number-format');
numberFormat(123456);

Output : 123,456

// format a float
var numberFormat = require('z-number-format');
numberFormat(123456.12345);

Output : 123,456.12345

var numberFormat = require('z-number-format');
numberFormat("123456");

Output : 123,456

var numberFormat = require('z-number-format');
numberFormat(123456,'wan');

Output : 12,3456

var numberFormat = require('z-number-format');
numberFormat(123456,'wan','-');

Output : 12-3456

var numberFormat = require('z-number-format');
numberFormat(3000000,'laxh');

Output : 30,00,000

Keywords

z-number-format

FAQs

Package last updated on 26 Sep 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts