Skip to content

Instantly share code, notes, and snippets.

@robinpokorny
Last active August 16, 2021 07:31
Show Gist options
  • Save robinpokorny/83ceafb4cc7dd8698d1fdc9ad69ba980 to your computer and use it in GitHub Desktop.
Save robinpokorny/83ceafb4cc7dd8698d1fdc9ad69ba980 to your computer and use it in GitHub Desktop.
const isNone = (value: unknown) => value === None
const hasNone = (arr: Array<unknown>) =>
arr.some((x) => x === None)
const map = <T, S>(
fn: (x: T) => S,
value: T | typeof None
) => {
if (value === None) {
return None
} else {
return fn(value)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment