1.1.0 • Published 9 years ago

fsuxx v1.1.0

Weekly downloads
3
License
MIT
Repository
github
Last release
9 years ago

npm version Build Status

Takes a number and returns fixed digit string

Examples

var fsuxx = require("fsuxx");

console.log(fsuxx(0.199000000000000004));           // "0.199"
console.log(fsuxx(0.199000000000000004, 2));        // "0.2"
console.log(fsuxx(0.199000000000000004, 2, true));  // "0.20"

Documentation

fsuxx(num, digits, trailing) ⇒ string

Takes a number and returns a rounded fixed digit string. Returns an empty string if first parameter is (-)Infinity or parseFloat results in NaN. If parameter trailing is set to true trailing zeros will be kept.

ParamTypeDefaultDescription
numnumberthe number
digitsnumber3digit count
trailingbooleanfalsekeep trailing zeros
commabooleanfalseuse comma as decimal separator

License

MIT (c) Sebastian Raff https://github.com/hobbyquaker