-
Notifications
You must be signed in to change notification settings - Fork 0
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
Sean Hamilton
committed
Nov 29, 2018
1 parent
aa7170a
commit 055a50a
Showing
1 changed file
with
24 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
// o | ||
import is from './is'; | ||
import size from './size'; | ||
|
||
/** | ||
* Check if an object is empty (has no keys) | ||
* | ||
* @param {object} object The object to check | ||
* | ||
* @returns {boolean} Whether it is empty | ||
*/ | ||
function empty(object) { | ||
// check if the object specified is an object | ||
if (is(object)) { | ||
// if it is get the size of the object and return true if it | ||
// is larger then 0 meaning it isn't empty | ||
return !(size(object) > 0); | ||
} | ||
|
||
// return false if the object isn't an object | ||
return false; | ||
} | ||
|
||
export default empty; |