Merge pull request #33874 from backstage/rugvip/remove-unused-param-parsers

catalog-backend: remove unused param parsers
This commit is contained in:
Patrik Oldsberg
2026-04-13 18:43:43 +02:00
committed by GitHub
@@ -16,48 +16,6 @@
import { InputError } from '@backstage/errors';
/**
* Takes a single unknown parameter and makes sure that it's a string that can
* be parsed as an integer.
*/
export function parseIntegerParam(
param: unknown,
ctx: string,
): number | undefined {
if (param === undefined) {
return undefined;
}
if (typeof param !== 'string') {
throw new InputError(`Invalid ${ctx}, not an integer on string form`);
}
const parsed = parseInt(param, 10);
if (!Number.isInteger(parsed) || String(parsed) !== param) {
throw new InputError(`Invalid ${ctx}, not an integer`);
}
return parsed;
}
/**
* Takes a single unknown parameter and makes sure that it's a string.
*/
export function parseStringParam(
param: unknown,
ctx: string,
): string | undefined {
if (param === undefined) {
return undefined;
}
if (typeof param !== 'string') {
throw new InputError(`Invalid ${ctx}, not a string`);
}
return param;
}
/**
* Takes a single unknown parameter and makes sure that it's a single string or
* an array of strings, and returns as an array.