ramda: hasPath does not work if one attribute in the path is undefined

hasPath does not work if one attribute in the path is undefined

If one of the object attributes in the path is undefined, hasPath throws an error. it should return false.

R.hasPath(['a', 'b'], { a: undefined });
=> TypeError: Cannot convert undefined or null to object
// expected false

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Reactions: 3
  • Comments: 17 (7 by maintainers)

Commits related to this issue

Most upvoted comments

I’ve been away from Ramda for a few weeks, and am trying to get back. I will try to publish again soon, and this change should then be included.

yes, thanks for checking that out @machad0

We use pathOr as a workaround in some cases thou.

Greetings!

@machad0 do please go ahead. 😃

Hi @sespinozj, are you still into this issue? If you don’t, I’d like to try

cheers