Return true if the given value is a string that can be parsed as an integer.
isIntString("0"); // => trueisIntString("0.1"); // => falseisIntString("+1"); // => false
npx atmx add helper is-int-string
Copy and paste the following method into @/utils/helpers/undefined.ts:
@/utils/helpers/undefined.ts
import { isString } from "@/helpers/is-string.ts"; /*** Return true if the given value is a string that can be parsed as an* integer.** @example* isIntString('0') // => true* isIntString('0.1') // => false* isIntString('+1') // => false*/export function isIntString(value: any): value is string {if (!isString(value)) {return false;}const num = +value;return Number.isInteger(num) && `${num}` === value;}