Skip to content

Instantly share code, notes, and snippets.

@bcardarella
Created August 8, 2015 23:05
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bcardarella/517e7ccc916765b64bb7 to your computer and use it in GitHub Desktop.
Save bcardarella/517e7ccc916765b64bb7 to your computer and use it in GitHub Desktop.
function unroundedFixed(number, precision) {
let [left, right] = number.toString().split('.');
[right] = right.match(new RegExp(`[0-9]{${precision}}`));
return [left, right].join('.');
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment