Skip to content

Commit b2b45a2

Browse files
committed
[object] isEmpty accepts undefined and null
1 parent cfe34a4 commit b2b45a2

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

object.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,10 +74,9 @@ export const some = (obj, f) => {
7474
}
7575

7676
/**
77-
* @param {Object|undefined} obj
77+
* @param {Object|null|undefined} obj
7878
*/
7979
export const isEmpty = obj => {
80-
// eslint-disable-next-line
8180
for (const _k in obj) {
8281
return false
8382
}

object.test.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@ export const testObject = _tc => {
3434
t.assert(object.length({ x: 1 }) === 1)
3535
t.assert(object.isEmpty({}))
3636
t.assert(!object.isEmpty({ a: 3 }))
37+
t.assert(object.isEmpty(null))
38+
t.assert(object.isEmpty(undefined))
3739
}
3840

3941
/**

0 commit comments

Comments
 (0)