Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 3 additions & 8 deletions packages/cli-kit/src/public/common/string.ts
Original file line number Diff line number Diff line change
Expand Up @@ -234,14 +234,9 @@ export function pluralize<
* @returns The int if it was able to convert, otherwise undefined.
*/
export function tryParseInt(maybeInt: string | undefined): number | undefined {
let asInt: number | undefined
if (maybeInt !== undefined) {
asInt = parseInt(maybeInt, 10)
if (isNaN(asInt)) {
asInt = undefined
}
}
return asInt
if (maybeInt === undefined) return undefined
const asInt = Number.parseInt(maybeInt, 10)
return Number.isNaN(asInt) ? undefined : asInt
}

/**
Expand Down
Loading