Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import { map, filter, partial, partialRight, curry, __, pipe } from "ramda"
- const publishedInYear = curry((year, book) => book.year === year)
- const titlesForYear = curry((year, books) =>
- pipe(
- filter(publishedInYear(year)),
- map(book => book.title),
- )(books),
- )
- const books = [
- { year: 2000, title: "OMG" },
- { year: 2000, title: "QBT" },
- { year: 2001, title: "SDF" },
- { year: 2001, title: "SFE" },
- { year: 2002, title: "HHJ" },
- ]
- console.log("titlesForYear(books, 2000", titlesForYear(2000, books))
Add Comment
Please, Sign In to add comment