Skip to content

Commit 96098ad

Browse files
committed
fix: resolves issue with CatalogSearcher
Signed-off-by: Anthony D. Mays <[email protected]>
1 parent 1d37e84 commit 96098ad

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

lesson_26/api/javascript/api_app/src/library/library.service.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ export class LibraryService {
1818

1919
constructor(id: string) {
2020
this.id = id;
21-
this.searcher = new CatalogSearcher(this.itemsById.values());
21+
this.searcher = new CatalogSearcher(this.itemsById);
2222
}
2323

2424
getId(): string {

lesson_26/api/javascript/api_app/src/library/search/catalog_searcher.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@ import { SearchCriteria } from './search_criteria';
22
import { Searchable } from './searchable';
33

44
export class CatalogSearcher<T extends Searchable> {
5-
private catalog: Iterable<T>;
5+
private catalog: ReadonlyMap<string, T>;
66

7-
constructor(catalog: Iterable<T>) {
7+
constructor(catalog: ReadonlyMap<string, T>) {
88
this.catalog = catalog;
99
}
1010

1111
search(query: SearchCriteria): T[] {
12-
return [...this.catalog].filter((item) => item.matches(query));
12+
return [...this.catalog.values()].filter((item) => item.matches(query));
1313
}
1414
}

0 commit comments

Comments
 (0)