Guest User

Untitled

a guest
Jun 24th, 2018
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.51 KB | None | 0 0
  1. import { map, filter, partial, partialRight, curry, __, pipe } from "ramda"
  2.  
  3. const publishedInYear = curry((year, book) => book.year === year)
  4.  
  5. const titlesForYear = curry((year, books) =>
  6. pipe(
  7. filter(publishedInYear(year)),
  8. map(book => book.title),
  9. )(books),
  10. )
  11.  
  12. const books = [
  13. { year: 2000, title: "OMG" },
  14. { year: 2000, title: "QBT" },
  15. { year: 2001, title: "SDF" },
  16. { year: 2001, title: "SFE" },
  17. { year: 2002, title: "HHJ" },
  18. ]
  19.  
  20. console.log("titlesForYear(books, 2000", titlesForYear(2000, books))
Add Comment
Please, Sign In to add comment