These are chat archives for ramda/ramda

17th
Jul 2016
Ronn
@ronnross
Jul 17 2016 11:58

I'm getting an error Uncaught TypeError: Illegal invocation when trying to call

var processSlides = R.pipe(
  R.find(x => x.id == state.params.id),
  console.log
)

I'm calling like processSlides(state.decks). Is there something I am missing?

Oh I figured it out. Thanks all
Ronn
@ronnross
Jul 17 2016 12:35
I again I'm trying to use a function from the Ramda cookbook. I'm hoping this function will retrieve an object from a list that matches an id
// findById :: String -> Array -> Object
const findById = R.converge(
  R.find,
  [R.pipe(R.nthArg(0), R.propEq("id")), R.nthArg(1)]
);
I see from the annotation that it takes a string and an array. Is the string supposed to be the id I'm looking for?
Sorry, but point free is still a bit confusing for me.
so when calling I should do findById("1", myList)?
Ronn
@ronnross
Jul 17 2016 14:07
Ah figured it out again. My id was being passed in as a string, but needed a number. Sorry for rubber ducking the chat room.
Rob Halff
@rhalff
Jul 17 2016 19:44
How to do a nested has? there is not something like hasPath() it seems.
Rob Halff
@rhalff
Jul 17 2016 19:55
I'm gonna be bold and use lodashfp's has for that.
Emilio Srougo
@Emilios1995
Jul 17 2016 23:53
@rhalff You could use R. pathSatisfies passing a function that checks for undefined