Skip to content

Instantly share code, notes, and snippets.

@wmakeev
Created July 25, 2023 16:29
Show Gist options
  • Save wmakeev/2f6dca8d397d4e09c12ac47981bb5c57 to your computer and use it in GitHub Desktop.
Save wmakeev/2f6dca8d397d4e09c12ac47981bb5c57 to your computer and use it in GitHub Desktop.
[JS typeguards] #typescript #typeguard #js #jsdoc
/**
* Checks if the value is neither `null` or `undefined`.
* @template T
* @param {T} value The value to check.
* @returns { value is NonNullable<T> } Returns `true` if `value` is non-nullable, else `false`.
*/
export default function isNonNullable(value) {
return value != null
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment