ChemPal Documentation - v0.0.13-beta.5
    Preparing search index...

    Function isPopulatedObject

    • Checks if an object is empty.

      Parameters

      • obj: unknown

        The object to check

      Returns obj is Record<string, unknown>

      True if the object is empty, false otherwise

      isPopulatedObject({}) // Returns false
      
      isPopulatedObject({ a: 1 }) // Returns true
      
      isPopulatedObject(null) // Returns false
      
      export function isPopulatedObject(obj: unknown): obj is Record<string, unknown> {
      return (
      typeof obj === "object" &&
      obj !== null &&
      Array.isArray(obj) === false &&
      Object.entries(obj).length > 0
      );
      }