File

libs/common/src/lib/utils/compare-data-option.ts

Index

Properties

Properties

value
Type string
interface ObjectWithValueProperty {
  value: string;
}

/**
 * Utility function to be used inside of Building blocks to provide possibility compare dataOption object by value in the dropdowns.
 * @param { ObjectWithValueProperty } listValue is a DataOption object with element from the dropdownL array with value
 * @param { ObjectWithValueProperty } selectedValue is a DataOption object with the value for compare with value
 * @returns { boolean } is equal or not
 */
export function compareDataOption<T extends ObjectWithValueProperty>(
  listValue: T,
  selectedValue: T | null
) {
  return listValue.value === selectedValue?.value;
}

results matching ""

    No results matching ""