svcorelib
Version:
Core library used in the projects of Sv443 and the Sv443 Network. Contains tons of miscellaneous QoL features.
22 lines (17 loc) • 569 B
JavaScript
const isEmpty = require("./isEmpty");
function isArrayEmpty(array)
{
if((array === "" || array == null) || typeof array != "object")
throw new Error(`Wrong or empty arguments provided for scl.isArrayEmpty() - (expected: "object", got: "${typeof array}")`);
let emptiness = 0;
array.forEach(item => {
if(isEmpty(item))
emptiness++;
});
if(emptiness == array.length)
return true;
else if(emptiness == 0)
return false;
else return emptiness;
}
module.exports = isArrayEmpty;