fix(cli): harden pairing provider parse
This commit is contained in:
@@ -23,7 +23,13 @@ const PROVIDERS: PairingProvider[] = [
|
|||||||
];
|
];
|
||||||
|
|
||||||
function parseProvider(raw: unknown): PairingProvider {
|
function parseProvider(raw: unknown): PairingProvider {
|
||||||
const value = String(raw ?? "")
|
const value = (
|
||||||
|
typeof raw === "string"
|
||||||
|
? raw
|
||||||
|
: typeof raw === "number" || typeof raw === "boolean"
|
||||||
|
? String(raw)
|
||||||
|
: ""
|
||||||
|
)
|
||||||
.trim()
|
.trim()
|
||||||
.toLowerCase();
|
.toLowerCase();
|
||||||
if ((PROVIDERS as string[]).includes(value)) return value as PairingProvider;
|
if ((PROVIDERS as string[]).includes(value)) return value as PairingProvider;
|
||||||
|
|||||||
Reference in New Issue
Block a user