rename function any to some to be consistent with the array method

This commit is contained in:
Dan Percic 2023-02-09 22:13:37 +02:00
parent 7c1c031429
commit b8c3b76e56
4 changed files with 7 additions and 7 deletions

View File

@ -4,7 +4,7 @@ import { map, startWith, switchMap } from 'rxjs/operators';
import { processFilters, toFlatFilters } from './filter-utils';
import { IFilterGroup } from './models/filter-group.model';
import { INestedFilter } from './models/nested-filter.model';
import { any, get, shareDistinctLast, shareLast } from '../utils';
import { get, shareDistinctLast, shareLast, some } from '../utils';
import { NestedFilter } from './models/nested-filter';
import { Filter } from './models/filter';
import { IFilter } from './models/filter.model';
@ -42,7 +42,7 @@ export class FilterService {
private get _showResetFilters$(): Observable<boolean> {
return this.filterGroups$.pipe(
map(value => toFlatFilters(value)),
any(filter => !!filter.checked),
some(filter => !!filter.checked),
shareDistinctLast(),
);
}

View File

@ -1,7 +1,7 @@
import { ChangeDetectionStrategy, Component, Input, OnInit, TemplateRef } from '@angular/core';
import { BehaviorSubject, combineLatest, Observable } from 'rxjs';
import { delay, map } from 'rxjs/operators';
import { any, shareDistinctLast, shareLast } from '../../utils';
import { shareDistinctLast, shareLast, some } from '../../utils';
import { FilterService } from '../filter.service';
import { IFilterGroup } from '../models/filter-group.model';
import { marker as _ } from '@biesbjerg/ngx-translate-extract-marker';
@ -32,7 +32,7 @@ export class PopupFilterComponent implements OnInit {
private get _hasActiveFilters$() {
return combineLatest([this.primaryFilterGroup$, this.secondaryFilterGroup$]).pipe(
map(([primary, secondary]) => [...(primary?.filters || []), ...(secondary?.filters || [])]),
any(f => f.checked || !!f.indeterminate),
some(f => f.checked || !!f.indeterminate),
shareDistinctLast(),
);
}

View File

@ -5,7 +5,7 @@ import { FilterService, getFilteredEntities } from '../../filtering';
import { SearchService } from '../../search';
import { Id, IListable } from '../models';
import { EntitiesService } from './entities.service';
import { any, getLength, shareDistinctLast, shareLast } from '../../utils';
import { getLength, shareDistinctLast, shareLast, some } from '../../utils';
import { SortingService } from '../../sorting';
@Injectable()
@ -114,7 +114,7 @@ export class ListingService<Class extends IListable<PrimaryKey>, PrimaryKey exte
isSelected$(entity: Class): Observable<boolean> {
return this._selected$.pipe(
any(selectedId => selectedId === entity.id),
some(selectedId => selectedId === entity.id),
shareLast(),
);
}

View File

@ -6,7 +6,7 @@ export function get<T>(predicate: (value: T, index: number) => boolean): Operato
return map(entities => entities.find(predicate));
}
export function any<T>(predicate: (value: T, index: number) => boolean): OperatorFunction<readonly T[], boolean> {
export function some<T>(predicate: (value: T, index: number) => boolean): OperatorFunction<readonly T[], boolean> {
return map(entities => entities.some(predicate));
}