UNPKG

@empathyco/x-components

Version:
37 lines (35 loc) 1.07 kB
/** * Compares if two lists contains the same filters. * * @param someFilters - A list of filters to compare. * @param anotherFilters - Another list of filters to compare. * * @returns True if the two lists of filters are equal, which means that they have the same * filters. The position of the filter does not matter for this check. * * @public */ function areFiltersDifferent(someFilters, anotherFilters) { return (someFilters.length !== anotherFilters.length || someFilters.some(filter => !anotherFilters.find(otherFilter => otherFilter.id === filter.id))); } /** * Helper method which creates the filter entity from the filter ir of the url. * * @param filterIds - List of filter ids from the url. * * @returns A list of filters. * * @public */ function createRawFilters(filterIds) { return filterIds.map(filterId => { return { id: filterId, modelName: 'RawFilter', selected: true, }; }); } export { areFiltersDifferent, createRawFilters }; //# sourceMappingURL=filters.js.map