Advertisement
Guest User

Untitled

a guest
Jun 18th, 2019
132
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.70 KB | None | 0 0
  1. searchBooksByDetails(sc: any): Observable<Array<Book>> {
  2. this.books$ = this.getBooks();
  3. this.books$ = this.books$.pipe(
  4. debounceTime(2000),
  5. map(books =>
  6. books.filter(
  7. book =>
  8. book.title.toLowerCase().includes(sc.title.toLowerCase()) &&
  9. book.author.toLocaleLowerCase().includes(sc.author.toLocaleLowerCase()) &&
  10. book.publisher.toLowerCase().includes(sc.publisher.toLowerCase()) &&
  11. (sc.category === 'ALL' || book.category === sc.category) &&
  12. (!sc.publishedFrom || book.publicationDate > sc.publishedFrom) &&
  13. (!sc.publishedTo || book.publicationDate < sc.publishedTo)
  14. )
  15. )
  16. );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement