Variable ProductTemplatesHelpersConst

ProductTemplatesHelpers: {
    fieldMustMatch: ((fieldName: string, valuesToMatch: string[]) => ProductTemplateCondition);
    fieldMustNotMatch: ((fieldName: string, disallowedValues: string[]) => ProductTemplateCondition);
    fieldsMustBeDefined: ((fieldNames: string[]) => ProductTemplateCondition);
    fieldsMustNotBeDefined: ((fieldNames: string[]) => ProductTemplateCondition);
    getProductProperty: ((product: ChildProduct | Product, property: string) => unknown);
} = ...

Type declaration

  • fieldMustMatch: ((fieldName: string, valuesToMatch: string[]) => ProductTemplateCondition)
      • (fieldName, valuesToMatch): ProductTemplateCondition
      • Creates a condition that verifies whether the value of a field is equal to any of the specified values (casing insensitive).

        Parameters

        • fieldName: string

          (string) - The name of the field to evaluate the condition against.

        • valuesToMatch: string[]

        Returns ProductTemplateCondition

        (ProductTemplateCondition) - A function that takes a Product as an argument and returns "true" if the value for the specified field is equal to any of the values in the specified list (case insensitive), and "false" otherwise.

  • fieldMustNotMatch: ((fieldName: string, disallowedValues: string[]) => ProductTemplateCondition)
      • (fieldName, disallowedValues): ProductTemplateCondition
      • Creates a condition that verifies whether the value of a field is not equal to any of the specified values (case insensitive).

        Parameters

        • fieldName: string

          (string) - The name of the field to evaluate the condition against.

        • disallowedValues: string[]

          (string[]) - The list of values that the field value must not be equal to in order for the condition to evaluate to "true" (case insensitive).

        Returns ProductTemplateCondition

        (ProductTemplateCondition) A function that takes a Product as an argument and returns "true" if the value for the specified field is not equal to any of the values in the given list (case insensitive), or "false" otherwise.

  • fieldsMustBeDefined: ((fieldNames: string[]) => ProductTemplateCondition)
      • (fieldNames): ProductTemplateCondition
      • Creates a condition that verifies if the specified fields are defined.

        Parameters

        • fieldNames: string[]

          (string[]) - A list of fields that must be defined.

        Returns ProductTemplateCondition

        (ProductTemplateCondition) A function that takes a product and checks if every field in the specified list is defined.

  • fieldsMustNotBeDefined: ((fieldNames: string[]) => ProductTemplateCondition)
      • (fieldNames): ProductTemplateCondition
      • Creates a condition that verifies if the specified fields are not defined.

        Parameters

        • fieldNames: string[]

          (string[]) - A list of fields that must not be defined.

        Returns ProductTemplateCondition

        (ProductTemplateCondition) A function that takes a product and checks if every field in the specified list is not defined.

  • getProductProperty: ((product: ChildProduct | Product, property: string) => unknown)
      • (product, property): unknown
      • Extracts a property from a product object.

        Parameters

        • product: ChildProduct | Product

          (Product) - The target product.

        • property: string

          (string) - The property to extract.

        Returns unknown

        (unknown) The value of the specified property in the specified product, or null if the property does not exist.