Handling Empty Values with Option in TypeScript

I see Option.fromNullable, but is there some mechanism to do something like Option.fromEmpty, other than globalThis.location.search.length === 0 ? Option.none() : Option.some(globalThis.location.search)
Was this page helpful?