Skip to content

Commit

Permalink
fix(safe-math): remove memoize, its a memory leak
Browse files Browse the repository at this point in the history
  • Loading branch information
iam4x committed Apr 17, 2023
1 parent c96123a commit 9277dd2
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/utils/safe-math.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
import { memoize } from 'lodash';

export const afterDecimal = memoize((num: number | string) => {
export const afterDecimal = (num: number | string) => {
if (Number.isInteger(num)) return 0;

const str = num?.toString?.();
Expand All @@ -11,7 +9,7 @@ export const afterDecimal = memoize((num: number | string) => {
}

return str?.split?.('.')?.[1]?.length || 2;
});
};

export const adjust = (value: number, step: number | string) => {
const multiplier = 1 / Number(step);
Expand Down

0 comments on commit 9277dd2

Please sign in to comment.