These are chat archives for ramda/ramda

7th
May 2018
Jean-Baptiste Rudant
@BoogalooJB
May 07 2018 15:52
Hi guys, new to ramda and didn't manage to make this simple example work: https://goo.gl/Fa1CvH ? Any help appreciated.
const data = {
  peopleOfInterestIds: ["b", "c"],
  nameById: {
    a: "A",
    b: "B",
    c: "C",
    d: "D"
  }
};

const getPeopleIds = R.prop("peopleOfInterestIds");

// Arghhhhh, how do I make `getPeopleIds` being called with my `data` argument ?
// const getPeopleNames = R.pipe(R.prop('nameById'), R.props(getPeopleIds))

const getPeopleNames = data => 
  R.pipe(R.prop('nameById'), R.props(getPeopleIds(data)))(data)

getPeopleNames(data)
Brad Compton (he/him)
@Bradcomp
May 07 2018 16:11
@BoogalooJB You can use lift on props to apply your two other functions first
@ram-bot
const data = {
  peopleOfInterestIds: ["b", "c"],
  nameById: {
    a: "A",
    b: "B",
    c: "C",
    d: "D"
  }
};


lift(props)(prop('peopleOfInterestIds'), prop('nameById'))(data);
Ugh, ram-bot hasn't been helping me lately.
converge will do the same thing in this case: https://goo.gl/4qo7YT
@ram-bot
1 + 1
Jean-Baptiste Rudant
@BoogalooJB
May 07 2018 16:16
@Bradcomp Thank you very much. I think I need some time to get a grasp of it, but at least I know where to start. Thanks !!!
Brad Compton (he/him)
@Bradcomp
May 07 2018 16:26
lift can be initially confusing, but it's a really powerful function so it's worth digging into.
:bowtie: