Safely extract a key from a Maybe of an object, returning
Just if the key has a value on the object and
Nothing if it does not. (Like property but
operating on a Maybe<T> rather than directly on a T.)
The check is type-safe: you won't even be able to compile if you try to look
up a property that TypeScript knows doesn't exist on the object.
Safely extract a key from a
Maybe
of an object, returningJust
if the key has a value on the object andNothing
if it does not. (Likeproperty
but operating on aMaybe<T>
rather than directly on aT
.)The check is type-safe: you won't even be able to compile if you try to look up a property that TypeScript knows doesn't exist on the object.
However, it also works correctly with dictionary types:
The order of keys is so that it can be partially applied: