Convert a base-10 or scientific E-notation value to a decimal form string.
npm install number-to-decimal-form-string-x href="https://travis-ci.org/Xotic750/number-to-decimal-form-string-x"
title="Travis status"> src="https://travis-ci.org/Xotic750/number-to-decimal-form-string-x.svg?branch=master"
alt="Travis status" height="18">
href="https://david-dm.org/Xotic750/number-to-decimal-form-string-x"
title="Dependency status"> alt="Dependency status" height="18"/>
href="https://david-dm.org/Xotic750/number-to-decimal-form-string-x?type=dev"
title="devDependency status"> alt="devDependency status" height="18"/>
href="https://badge.fury.io/js/number-to-decimal-form-string-x"
title="npm version"> alt="npm version" height="18">
href="https://www.jsdelivr.com/package/npm/number-to-decimal-form-string-x"
title="jsDelivr hits"> alt="jsDelivr hits" height="18">
href="https://bettercodehub.com/results/Xotic750/number-to-decimal-form-string-x"
title="bettercodehub score"> alt="bettercodehub score" height="18">
href="https://coveralls.io/github/Xotic750/number-to-decimal-form-string-x?branch=master"
title="Coverage Status"> alt="Coverage Status" height="18">
Convert a base-10 or scientific E-notation value to a decimal form string.
This method converts a base-10 or scientific E-notation value to
a decimal form string. Javascript's IEE 754 double-precision numbers
give the same precision as number.toString().
Kind: Exported function
Returns: string - The value converted to a decimal form string.
Throws:
- TypeError If value is not a valid format.
- TypeError If value is a Symbol or not coercible.
| Param | Type | Description |
| ----- | ------------------------------------------ | -------------------------- |
| value | number \| string | The value to be converted. |
Example
``js
import toDecimalFormString from 'number-to-decimal-form-string-x';
toDecimalFormString(Number.MIN_SAFE_INTEGER); // '-9007199254740991'
toDecimalFormString(-0); // '-0'
let number = 0.00000000001;
number.toString(); // '1e-11'
toDecimalFormString(number); // '0.00000000001'
number = 88259496234518.57;
console.log(number.toString()); // '88259496234518.56';
console.log(toDecimalFormString(number)); // '88259496234518.56'
console.log(toDecimalFormString(Math.PI)); // '3.141592653589793'
console.log(toDecimalFormString(Number.MAX_SAFE_INTEGER)); // '9007199254740991'
console.log(toDecimalFormString('0e+0')); // '0'
console.log(toDecimalFormString('1e-11')); // '0.00000000001'
console.log(toDecimalFormString('4.062e-3')); // '0.004062'
console.log(toDecimalFormString('4.461824e+2')); // '446.1824'
toDecimalFormString(NaN); // TypeError
toDecimalFormString(' 0'); // TypeError
toDecimalFormString('0 '); // TypeError
toDecimalFormString('0.'); // TypeError
toDecimalFormString('.0'); // TypeError
toDecimalFormString('0x1'); // TypeError
toDecimalFormString('0o1'); // TypeError
toDecimalFormString('0b1'); // TypeError
toDecimalFormString('4.062 e-3'); // TypeError
toDecimalFormString('9 007 199 254 740 991'); // TypeError
toDecimalFormString('9,007,199,254,740,991'); // TypeError
toDecimalFormString(Symbol('0')); // TypeError
toDecimalFormString(Object.create(null)); // TypeError
``