From 5ad84a735705427f75e4e3347a7048afcd864a9f Mon Sep 17 00:00:00 2001 From: MTG2000 Date: Thu, 26 May 2022 20:31:35 +0300 Subject: [PATCH] bug: handle edge case in numberFormatter --- src/utils/helperFunctions.tsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/utils/helperFunctions.tsx b/src/utils/helperFunctions.tsx index 79c3384..7e9cf5d 100644 --- a/src/utils/helperFunctions.tsx +++ b/src/utils/helperFunctions.tsx @@ -1,5 +1,6 @@ import React, { ComponentProps, ComponentType, ReactNode, Suspense } from "react"; import { RotatingLines } from "react-loader-spinner"; +import { isNullOrUndefined } from "remirror"; export function random(min: number, max: number) { return Math.random() * (max - min) + min; @@ -18,7 +19,7 @@ export function isMobileScreen() { } export function numberFormatter(num?: number, digits = 1) { - if (!num) return; + if (isNullOrUndefined(num)) return; const lookup = [ { value: 1, symbol: "" },