Skip to content

Commit

Permalink
Improve lodash import in round to step utility.
Browse files Browse the repository at this point in the history
  • Loading branch information
AndrewZinko committed Sep 15, 2023
1 parent f46ca3d commit 6e181c5
Showing 1 changed file with 2 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,9 @@ import precision from 'precision';

import { RoundedNumber } from '../price-calculator.monad';

import { ceil, floor, round } from '$imports/lodash';
import * as lodash from '$imports/lodash';

const MAX_PRECISION = 12;
const mathFunctions = { ceil, floor, round };

type RoundDirection = 'ceil' | 'round' | 'floor';

Expand All @@ -14,7 +13,7 @@ export const roundToStep = (
numberStep: number,
roundDirection: RoundDirection,
) => {
const roundFunction = mathFunctions[roundDirection];
const roundFunction = lodash[roundDirection];
const value = new RoundedNumber(numberValue, MAX_PRECISION);
const step = new RoundedNumber(numberStep, MAX_PRECISION);

Expand Down

0 comments on commit 6e181c5

Please sign in to comment.