astuanax/funmatrix

View on GitHub
src/util/round.js

Summary

Maintainability
A
0 mins
Test Coverage
/**
 * @function round
 * @param value {Number}
 * @param decimals {Number}
 * @returns {Number}
 */
export default function round (value, decimals = 4) {
  return Number(Number.parseFloat(value).toPrecision(decimals))
}