change(rewrite): Rename parseIntOrThrow to parseInteger

This commit is contained in:
tecc 2023-09-15 15:04:58 +02:00
parent c1d6551301
commit 336ddb9408
No known key found for this signature in database
GPG Key ID: 622EEC5BAE5EBD3A
2 changed files with 3 additions and 3 deletions

View File

@ -2,7 +2,7 @@ import "dotenv/config";
import {
identity,
parseBool,
parseIntOrThrow,
parseInteger,
toLowerCase,
} from "@pronounspage/common/util";
import * as path from "node:path";
@ -84,7 +84,7 @@ export function loadConfigFromEnv(): Config {
http: {
baseUrl: envVarNotNull("HTTP_BASE_URL", identity),
host: envVarOrDefault("HTTP_HOST", identity, "0.0.0.0"),
port: envVarOrDefault("HTTP_PORT", parseIntOrThrow, 4000),
port: envVarOrDefault("HTTP_PORT", parseInteger, 4000),
},
security: {
secret: envVarNotNull("SECRET", identity),

View File

@ -29,7 +29,7 @@ export function toLowerCase<S extends string>(value: S): Lowercase<S> {
return value.toLowerCase() as Lowercase<S>;
}
export function parseIntOrThrow(value: string, radix?: number): number {
export function parseInteger(value: string, radix?: number): number {
if (radix != null && (radix < 2 || radix > 36)) {
throw new Error(
`invalid radix ${radix} - must be between 2 and 36 (inclusive)`