-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
74 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,30 @@ | ||
const isEmpty = (o) => Object.keys(o).length === 0; | ||
import isArray from '../lodash/is_array'; | ||
import isString from '../lodash/is_string'; | ||
import isObject from '../lodash/is_object'; | ||
import isMap from '../lodash/is_map'; | ||
import isSet from '../lodash/is_set'; | ||
|
||
export default isEmpty; | ||
export default function isEmpty(obj) { | ||
if (obj === null) { | ||
return true; | ||
} | ||
|
||
if (isArray(obj)) { | ||
return !obj.length; | ||
} | ||
|
||
if (isString(obj)) { | ||
return !obj.length; | ||
} | ||
|
||
if (isObject(obj)) { | ||
return !Object.keys(obj).length; | ||
} | ||
|
||
if (isMap(obj) || isSet(obj)) { | ||
return !obj.size; | ||
} | ||
|
||
// other primitive || unidentifed object type | ||
return Object(obj) !== obj || !Object.keys(obj).length; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
const version = '1.1.17'; | ||
const version = '1.1.18'; | ||
|
||
export default version; |