fixed-base.js 448 B

12345678910111213141516
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", { value: true });
  3. var fixedBase = function (v, base) {
  4. var str = base.toString();
  5. var index = str.indexOf('.');
  6. if (index === -1) {
  7. return Math.round(v);
  8. }
  9. var length = str.substr(index + 1).length;
  10. if (length > 20) {
  11. length = 20;
  12. }
  13. return parseFloat(v.toFixed(length));
  14. };
  15. exports.default = fixedBase;
  16. //# sourceMappingURL=fixed-base.js.map