selfrefactor/rambda

[BUG] `isEmpty` not checking for nullish values

RoyRao2333 opened this issue · 2 comments

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:

image image

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

image

Is this intensional or am I using this util wrong?

Context(which version of library)

rambda@9.2.1

I will check and get back to you. Txs for the nice words!

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()