ChemPare Documentation - v0.0.0
    Preparing search index...
    • Type guard to validate if a value is a valid availability status. Checks if the value is a string that matches one of the predefined AVAILABILITY enum values.

      Parameters

      • availability: unknown

        The value to check

      Returns availability is AVAILABILITY

      Type predicate indicating if the value is a valid AVAILABILITY enum value

      // Valid availability values
      if (isAvailability('IN_STOCK')) {
      console.log('Product is in stock');
      }
      if (isAvailability('OUT_OF_STOCK')) {
      console.log('Product is out of stock');
      }

      // Invalid availability values
      if (!isAvailability('available')) {
      console.log('Invalid availability status');
      }
      if (!isAvailability(123)) {
      console.log('Availability must be a string');
      }