moufking / tp-angular

tp
https://tp-tp.herokuapp.com
0 stars 0 forks source link

Des idées? #7

Closed nioperas06 closed 6 years ago

nioperas06 commented 6 years ago

On pourrait réduire ce code:

public bookFactory(item: any): Book {
    return new Book(
      item.id,
      item.volumeInfo.title,
      item.volumeInfo.subtitle,
      item.volumeInfo.authors,
      item.volumeInfo.publisher,
      item.volumeInfo.publishedDate,
      item.volumeInfo.description,
      item.volumeInfo.categories ? item.volumeInfo.categories.map((item) => item.split("/").pop().trim()) : ['N/A'],
      item.volumeInfo.imageLinks.thumbnail,
      item.volumeInfo.imageLinks.smallThumbnail
    )
  }

et le déplacer dans le constructeur de la classe Book. Des idées?