updates
This commit is contained in:
parent
a052315d24
commit
98ae1d5698
@ -45,14 +45,14 @@ export class FilterService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
addFilterGroup(value: FilterGroup): void {
|
addFilterGroup(value: FilterGroup): void {
|
||||||
const oldFilters = this.getFilterGroup(value.slug)?.filters;
|
const oldFilters = this.getGroup(value.slug)?.filters;
|
||||||
if (!oldFilters) return this._filterGroups$.next([...this.filterGroups, value]);
|
if (!oldFilters) return this._filterGroups$.next([...this.filterGroups, value]);
|
||||||
|
|
||||||
value.filters = processFilters(oldFilters, value.filters);
|
value.filters = processFilters(oldFilters, value.filters);
|
||||||
this._filterGroups$.next([...this.filterGroups.filter(f => f.slug !== value.slug), value]);
|
this._filterGroups$.next([...this.filterGroups.filter(f => f.slug !== value.slug), value]);
|
||||||
}
|
}
|
||||||
|
|
||||||
getFilterGroup(slug: string): FilterGroup | undefined {
|
getGroup(slug: string): FilterGroup | undefined {
|
||||||
return this.filterGroups.find(group => group.slug === slug);
|
return this.filterGroups.find(group => group.slug === slug);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1,3 +1,5 @@
|
|||||||
|
import { tap } from 'rxjs/operators';
|
||||||
|
|
||||||
export function capitalize(value: string): string {
|
export function capitalize(value: string): string {
|
||||||
return value.charAt(0).toUpperCase() + value.slice(1);
|
return value.charAt(0).toUpperCase() + value.slice(1);
|
||||||
}
|
}
|
||||||
@ -7,3 +9,5 @@ export function humanize(value: string, lowercase = true): string {
|
|||||||
|
|
||||||
return words.map(capitalize).join(' ');
|
return words.map(capitalize).join(' ');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export const log = tap(console.log);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user