Lift a nullable value into a Result. null and undefined become err(onNullish); any other value becomes ok.
null
undefined
err(onNullish)
ok
const findUser = (id: string) => fromNullable(users.get(id), { code: "NOT_FOUND", id }) Copy
const findUser = (id: string) => fromNullable(users.get(id), { code: "NOT_FOUND", id })
Lift a nullable value into a Result.
nullandundefinedbecomeerr(onNullish); any other value becomesok.