index.js 378 B

12345678910111213
  1. var roundingMap = {
  2. ceil: Math.ceil,
  3. round: Math.round,
  4. floor: Math.floor,
  5. trunc: function trunc(value) {
  6. return value < 0 ? Math.ceil(value) : Math.floor(value);
  7. } // Math.trunc is not supported by IE
  8. };
  9. var defaultRoundingMethod = 'trunc';
  10. export function getRoundingMethod(method) {
  11. return method ? roundingMap[method] : roundingMap[defaultRoundingMethod];
  12. }