export function doFilterValuesMatch()

in packages/search-ui/src/helpers.ts [97:122]


export function doFilterValuesMatch(filterValue1, filterValue2) {
  if (filterValue1 === "true" || filterValue2 === "true")
    // Filter value has "true" value and facet may have 1 or "true"
    return (
      getFilterBooleanValue(filterValue1) ===
      getFilterBooleanValue(filterValue2)
    );
  if (
    filterValue1 &&
    filterValue1.name &&
    filterValue2 &&
    filterValue2.name &&
    filterValue1.name === filterValue2.name
  )
    // If two filters have matching names, then they are the same filter, there
    // is no need to do a more expensive deep equal comparison.
    //
    // This is also important because certain filters and facets will have
    // differing values than their corresponding facet options. For instance,
    // consider a time-based facet like "Last 10 Minutes". The value of the
    // filter will be different depending on when it was selected, but the name
    // will always match.
    return true;
  // We use 'strict = true' to do a '===' of leaves, rather than '=='
  return deepEqual(filterValue1, filterValue2, { strict: true });
}