js-number-to-local-string
TypeScript icon, indicating that this package has built-in type declarations

1.0.6 • Public • Published

Example Usage

import toLocalString from 'js-number-to-local-string';
// const toLocalString = require('js-number-to-local-string');
toLocalString() --> '0.00';
toLocalString(1) --> '1.00';
toLocalString(1.0) --> '1.00';
toLocalString(-1.0) --> '-1.00';
toLocalString(1000.0) --> '1,000.00';
toLocalString(-1000.0) --> '-1,000.00';
toLocalString(1000.1) --> '1,000.10';
toLocalString(1000.1111) --> '1,000.1111';
toLocalString('') --> '0.00';
toLocalString(null) --> '0.00';
toLocalString(undefined) --> '0.00';
toLocalString('1.0.1') --> 'Invalid number' --> '0.00';
toLocalString('-100..0') --> 'Invalid number' --> '0.00';
toLocalString(window) --> 'Invalid number [object Window]' --> '0.00';
toLocalString(function () {}) --> 'Invalid number function () {}' --> '0.00';

Dependencies (0)

    Dev Dependencies (0)

      Package Sidebar

      Install

      npm i js-number-to-local-string

      Weekly Downloads

      1

      Version

      1.0.6

      License

      MIT

      Unpacked Size

      2.65 kB

      Total Files

      5

      Last publish

      Collaborators

      • xiwell