uft
    Preparing search index...

    Function isObjectLoose

    • Checks if a value is typeof object and not null.

      Type Parameters

      • T

      Parameters

      • value: T

        The value to check.

      Returns value is T extends Function ? never : T & object

      true if the check passes, false otherwise.

      This function will return true for an array. If you do not want this behavior, use isObject instead.

      isObjectLoose({}) // true
      isObjectLoose([]) // true
      isPlainObject(null) // false
      const value: string | { foo: string }

      if (isObjectLoose(value)) {
      value // type: { foo: string }
      } else {
      value // type: string
      }

      // warning: arrays will pass
      const value: { bar: string } | string[] | null

      if (isObjectLoose(value)) {
      value // type: { bar: string } | string[]
      } else {
      value // type: null
      }