ChemPal Documentation - v1.6.0
    Preparing search index...

    Function isPresent

    • Reports whether a value is meaningfully populated: not null/undefined, not an empty string, and not NaN. Used to gate optional detail rows so blank fields are skipped in the panel.

      Parameters

      • value: unknown

        The value to test.

      Returns boolean

      true when the value is present and renderable, false otherwise.

      isPresent("NaCl"); // => true
      isPresent(""); // => false
      isPresent(NaN); // => false
      isPresent(undefined); // => false
      export function isPresent(value: unknown): boolean {
      if (value == null) return false;
      if (typeof value === 'string') return value.trim() !== '';
      if (typeof value === 'number') return !Number.isNaN(value);
      return true;
      }