Skip to content

Commit

Permalink
isEmpty return true for null | undefined
Browse files Browse the repository at this point in the history
  • Loading branch information
Harris-Miller committed Jun 18, 2024
1 parent 980b3bf commit 6e3a8ac
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 13 deletions.
2 changes: 1 addition & 1 deletion dist/ramda.js
Original file line number Diff line number Diff line change
Expand Up @@ -6155,7 +6155,7 @@
* R.isEmpty(Uint8Array.from('')); //=> true
*/
var isEmpty = _curry1(function isEmpty(x) {
return x != null && equals(x, empty(x));
return x != null || equals(x, empty(x));
});

/**
Expand Down
2 changes: 1 addition & 1 deletion dist/ramda.min.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion source/isEmpty.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,6 @@ import equals from './equals.js';
* R.isEmpty(Uint8Array.from('')); //=> true
*/
var isEmpty = _curry1(function isEmpty(x) {
return x != null && equals(x, empty(x));
return x == null || equals(x, empty(x));
});
export default isEmpty;
8 changes: 4 additions & 4 deletions test/isEmpty.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ var eq = require('./shared/eq.js');

describe('isEmpty', function() {

it('returns false for null', function() {
eq(R.isEmpty(null), false);
it('returns true for null', function() {
eq(R.isEmpty(null), true);
});

it('returns false for undefined', function() {
eq(R.isEmpty(undefined), false);
it('returns true for undefined', function() {
eq(R.isEmpty(undefined), true);
});

it('returns true for empty string', function() {
Expand Down
8 changes: 4 additions & 4 deletions test/isNotEmpty.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ var eq = require('./shared/eq.js');

describe('isNotEmpty', function() {

it('returns true for null', function() {
eq(R.isNotEmpty(null), true);
it('returns false for null', function() {
eq(R.isNotEmpty(null), false);
});

it('returns true for undefined', function() {
eq(R.isNotEmpty(undefined), true);
it('returns false for undefined', function() {
eq(R.isNotEmpty(undefined), false);
});

it('returns false for empty string', function() {
Expand Down

0 comments on commit 6e3a8ac

Please sign in to comment.