uft
    Preparing search index...

    Function isNull

    • Checks if a value is null.

      Parameters

      • value: unknown

        The value to check.

      Returns value is null

      true if the check passes, false otherwise.

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

      if (isNull(value)) {
      value // type: null
      } else {
      value // type: string
      }

      // or
      if (!isNull(value)) {
      value // type: string
      } else {
      value // type: null
      }
      import { assert, isNull } from 'uft'

      const token: string | null
      assert(!isNull(token), 'received null token')
      token // type: string