You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
19 lines
372 B
19 lines
372 B
3 years ago
|
/**
|
||
|
* Checks if a value is empty.
|
||
|
*/
|
||
|
function isEmpty(value) {
|
||
|
if (Array.isArray(value)) {
|
||
|
return value.length === 0
|
||
|
} else if (typeof value === 'object') {
|
||
|
if (value) {
|
||
|
for (const _ in value) {
|
||
|
return false
|
||
|
}
|
||
|
}
|
||
|
return true
|
||
|
} else {
|
||
|
return !value
|
||
|
}
|
||
|
}
|
||
|
|
||
|
export default isEmpty
|