From ebd785b5195d127039c1ed9a528b794281ab1e8d Mon Sep 17 00:00:00 2001 From: Jamie Brynes Date: Thu, 14 Mar 2024 23:33:46 +0000 Subject: [PATCH] chore: inline toInt function and remove utils file Grab bag of util functions makes me sad --- plugin/src/ui/settings/AutoRefreshIntervalControl.tsx | 3 +-- plugin/src/utils.ts | 8 -------- 2 files changed, 1 insertion(+), 10 deletions(-) delete mode 100644 plugin/src/utils.ts diff --git a/plugin/src/ui/settings/AutoRefreshIntervalControl.tsx b/plugin/src/ui/settings/AutoRefreshIntervalControl.tsx index 469b6fc..e674725 100644 --- a/plugin/src/ui/settings/AutoRefreshIntervalControl.tsx +++ b/plugin/src/ui/settings/AutoRefreshIntervalControl.tsx @@ -1,6 +1,5 @@ import React, { useState, type ChangeEvent } from "react"; import { Input, TextField } from "react-aria-components"; -import { toInt } from "../../utils"; type Props = { initialValue: number; @@ -20,7 +19,7 @@ export const AutoRefreshIntervalControl: React.FC = ({ initialValue, onCh return; } - const num = toInt(value); + const num = Math.floor(Number(value)); if (num < 0) { return; } diff --git a/plugin/src/utils.ts b/plugin/src/utils.ts deleted file mode 100644 index 27ae5f9..0000000 --- a/plugin/src/utils.ts +++ /dev/null @@ -1,8 +0,0 @@ -export function isPositiveInteger(str: string): boolean { - const num = toInt(str); - return num !== Infinity && String(num) === str && num > 0; -} - -export function toInt(str: string): number { - return Math.floor(Number(str)); -}