Browse Source

fix(pxCheck): typeof number check (#441)

xiejiahe 4 years ago
parent
commit
eddf282d66
1 changed files with 2 additions and 2 deletions
  1. 2 2
      src/utils/pxCheck.ts

+ 2 - 2
src/utils/pxCheck.ts

@@ -1,3 +1,3 @@
-export const pxCheck = (value: string | number) => {
-  return typeof Number(value) === 'number' ? `${value}px` : String(value);
+export const pxCheck = (value: string | number): string => {
+  return isNaN(Number(value)) ? String(value) : `${value}px`;
 };