es-toolkit icon indicating copy to clipboard operation
es-toolkit copied to clipboard

Support for `isEmpty`

Open TiBianMod opened this issue 1 year ago • 6 comments

Support for isEmpty is needed.

TiBianMod avatar Jul 23 '24 23:07 TiBianMod

There was a pull request adding an isEmpty function, but it was closed with a recommendation to use language primitives instead. I almost agree, but for objects, it becomes too cumbersome to check emptiness with obj && Object.keys(obj).length === 0. Having isEmpty(obj) would significantly improve readability and ease of use. Can we reconsider adding it for objects?

sairus2k avatar Aug 09 '24 08:08 sairus2k

me too~

akai007 avatar Oct 14 '24 10:10 akai007

same need this too

codelonesomest avatar Oct 22 '24 16:10 codelonesomest

I agree, handy indeed

damianobarbati avatar Oct 25 '24 11:10 damianobarbati

We now have a isEmpty function in es-toolkit/compat.

Let us add a new function isEmptyObject in our main library in the next version (v1.28.0).

raon0211 avatar Nov 10 '24 12:11 raon0211

Is isEmptyObject still planned @raon0211 ?

philippnagel avatar Apr 23 '25 21:04 philippnagel