rostero
Explore posts from serversAarktype
•Created by rostero on 4/18/2025 in #questions
How to ensure comma delimited set of numbers or fallback to undefined?
I'm trying to parse in some query string parameters, like "2,3,5" that I want parsed to [2, 3, 5]. I want to fail if any any number doesn't parse to an integer. When it fails I want to return undefined.
Note that this will be part of a larger type:
If param2 fails and fallback to undefined, I want the whole object to still parse and return
{ param1: "", param2: undefined }
20 replies