question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Ramda .isEmpty() calls jQuery .empty()

See original GitHub issue

When using Ramda to check if a jQuery object is empty, Ramda will call jQuery’s .empty() on the object, which in turns removes that element’s children from the DOM.

You can see a working demo here, https://jsfiddle.net/msmh0a83/.

I believe the error stems from here, https://github.com/ramda/ramda/blob/ef2516966351d9a27abcfdfeed0aa701cbeee15d/src/empty.js#L39.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:1
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

2reactions
jamonholmgrencommented, Jul 6, 2017

@codeithuman You could also pass in the node directly using .get(). Updated fiddle: https://jsfiddle.net/msmh0a83/1/

1reaction
kedashoecommented, Jun 30, 2017

I think in the future we may have more well defined dispatching. For example here we dispatch to the empty method, but jQuery’s empty was not designed with https://github.com/fantasyland/fantasy-land#empty-method in mind. Probably at some point we will drop built in support for empty in favor of fantasy-land/empty.

For now I would recommend

  1. calling jQuery’s methods directly
  2. creating wrapper functions around ramda functions you plan to use with jQuery objects

rather than passing jQuery objects directly as arguments to ramda functions.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How do I test for an empty JavaScript object? - Stack Overflow
If ECMAScript 5 support is available, you can use Object.keys() : function isEmpty(obj) { return Object.keys(obj).length === 0; }.
Read more >
remove R.isEmpty · Issue #1228 · ramda/ramda - GitHub
I understand the language, and do know that such is possible, I've had little call to actually create non-enumerable properties. I can easily ......
Read more >
How to use the ramda.isEmpty function in ramda - Snyk
To help you get started, we've selected a few ramda.isEmpty examples, based on popular ways it is used in public projects.
Read more >
flip - Ramda Documentation
A function wrapping calls to the two functions in an && operation, returning the ... R.empty(Just(42)); //=> Nothing() R.empty([1, 2, ... isEmpty Logic....
Read more >
Ramda.js R.without() Function - GeeksforGeeks
The without() function in Ramda is used to return the array with the particular set of values removed from it. It works as...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found