1
0
Fork 0
mirror of synced 2024-10-05 12:34:50 +13:00

Add a check to stringSplit that gives a nicer error message is a non-string is passed.

This commit is contained in:
Sam Rose 2024-01-29 17:38:52 +00:00
parent 2360df4258
commit b5672d676f
No known key found for this signature in database

View file

@ -131,6 +131,9 @@ export function stringSplit(value: string | string[]) {
if (value == null || Array.isArray(value)) {
return value || []
}
if (typeof value !== "string") {
throw new Error(`Unable to split value of type ${typeof value}: ${value}`)
}
if (value.split("\n").length > 1) {
value = value.split("\n")
} else {