3.0.0 • Published 4 years ago

@writetome51/get-left-of-decimal v3.0.0

Weekly downloads
1
License
MIT
Repository
github
Last release
4 years ago

getLeftOfDecimal(number): number

Returns number without the decimal or anything to the right of it. Does not round.

Examples:

getLeftOfDecimal(11.000001);
// -->  11

getLeftOfDecimal(11.999999);
// -->  11

getLeftOfDecimal(-11.999999);
// -->  -11

getLeftOfDecimal(0.000001);
// -->  0

getLeftOfDecimal(-0.999999);
// -->  0

getLeftOfDecimal('1.999999999999999');
// -->  1

getLeftOfDecimal('-0.000000001');
// -->  0

let result = getLeftOfDecimal('1.99999');
console.log(typeof result);
// 'number'

Installation

npm i @writetome51/get-left-of-decimal

Loading

import {getLeftOfDecimal} from '@writetome51/get-left-of-decimal';