[BUG] `isEmpty` not checking for nullish values
RoyRao2333 opened this issue · 2 comments
RoyRao2333 commented
Describe the bug
Just jumped from lodash to rambda. Great work by the way!
In lodash or radash, isEmpty
will return true
if the value itself is nullish:


But I noticed that isEmpty
in rambda skipped nullish values like undefined
or null
, which is a little counterintuitive for me :

Is this intensional or am I using this util wrong?
Context(which version of library)
rambda@9.2.1
selfrefactor commented
I will check and get back to you. Txs for the nice words!
selfrefactor commented
I will close it as this work as intended, i.e. it matches Ramda logic:
import { isEmpty } from 'ramda'
// import { isEmpty } from './isEmpty.js'
test('happy', () => {
expect(isEmpty(undefined)).toBeFalse()
expect(isEmpty('')).toBeTrue()
expect(isEmpty(null)).toBeFalse()
expect(isEmpty(' ')).toBeFalse()
expect(isEmpty(new RegExp(''))).toBeFalse()
expect(isEmpty([])).toBeTrue()
expect(isEmpty([ [] ])).toBeFalse()
expect(isEmpty({})).toBeTrue()
expect(isEmpty({ x : 0 })).toBeFalse()
expect(isEmpty(0)).toBeFalse()
expect(isEmpty(NaN)).toBeFalse()
expect(isEmpty([ '' ])).toBeFalse()