npm.io
1.2.2 • Published 7 years ago

math-trunc-x

Licence
MIT
Version
1.2.2
Deps
1
Size
220 kB
Vulns
0
Weekly
0

Travis status Dependency status devDependency status npm version jsDelivr hits bettercodehub score Coverage Status

math-trunc-x

Get the integer part of a number.

module.exports(value)number

This method returns the integer part of a number by removing any fractional digits.

Kind: Exported function
Returns: number - The truncated number.

Param Type Default Description
value number The number to be truncate.

Example

import mathTrunc from 'math-trunc-x';

mathTrunc(13.37); // 13
mathTrunc(42.84); // 42
mathTrunc(0.123); //  0
mathTrunc(-0.123); // -0
mathTrunc('-1.123'); // -1
mathTrunc(NaN); // NaN
mathTrunc('foo'); // NaN
mathTrunc(); // NaN

Keywords