1.1.0 • Published 9 years ago
fsuxx v1.1.0
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.
Param | Type | Default | Description |
---|---|---|---|
num | number | the number | |
digits | number | 3 | digit count |
trailing | boolean | false | keep trailing zeros |
comma | boolean | false | use comma as decimal separator |
License
MIT (c) Sebastian Raff https://github.com/hobbyquaker