Skip to content

writetome51/get-with-decimal-shifted

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

getWithDecimalShifted(
       num,
       numPlacesToMoveDecimal
): number

Returns num with decimal shifted by numPlacesToMoveDecimal.
numPlacesToMoveDecimal can be negative (to move the decimal left) or positive
(to move the decimal right).

Examples

getWithDecimalShifted(111.2345,  1);
    // --> 1112.345

getWithDecimalShifted(111.2345,  2);
    // --> 11123.45
 
 getWithDecimalShifted(1112345,  -1);
    // --> 111234.5
 
 getWithDecimalShifted(1112345,  -2);
    // --> 11123.45

Installation

npm i @writetome51/get-with-decimal-shifted

Loading

import { getWithDecimalShifted } from '@writetome51/get-with-decimal-shifted'; 

About

Takes number and returns it with decimal shifted by a given number places

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published