Last active
June 1, 2021 20:53
-
-
Save ajitid/cba9581355dd62e742fc97f981f4e975 to your computer and use it in GitHub Desktop.
validate string, number and object
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 function isNumber(input: unknown): input is number { | |
return Number.isFinite(input); | |
} | |
export function isString(input: unknown): input is string { | |
return typeof input === 'string'; | |
} | |
export function isObject(input: unknown): input is object { | |
return input !== null && typeof input === 'object'; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment