uft
    Preparing search index...

    Function isNullish

    • Checks if a value is null or undefined.

      Parameters

      • value: unknown

        The value to check.

      Returns value is null | undefined

      true if the check passes, false otherwise.

      isNullish(null) // true
      isNullish(undefined) // true
      isNullish(0) // false
      const value: string | null | undefined

      if (isNullish(value)) {
      value // type: null | undefined
      } else {
      value // type: string
      }

      // or
      if (!isNullish(value)) {
      value // type: string
      } else {
      value // type: null | undefined
      }
      import { assert } from 'uft'

      const token: string | null | undefined
      assert(!isNullish(token), 'received nullish token')
      token // string