Last active
February 28, 2021 06:47
-
-
Save cloud-walker/b13c8eeaef4394d631ae02748747e913 to your computer and use it in GitHub Desktop.
TypeScript utils
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export type Nully = null | undefined | |
export type Falsy = false | 0 | '' | Nully |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import {Nully} from './common.ts' | |
export const isNotNully = <T>(value: T): value is Exclude<T, Nully> => value != null && value != undefined |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import {Falsy} from './common.ts' | |
export const isTruthy = <T>(value: T): value is Exclude<T, Falsy> => !!value |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment