toFixedString.js 356 B

1234567891011121314
  1. var floor = require('./floor')
  2. var toFixed = require('./toFixed')
  3. /**
  4. * 和 Number.toFixed 类似,区别就是不会对小数进行四舍五入,结果返回字符串
  5. *
  6. * @param { String/Number } str 数值
  7. * @return {String}
  8. */
  9. function toFixedString (str, digits) {
  10. return toFixed(floor(str, digits), digits)
  11. }
  12. module.exports = toFixedString