svcorelib
Version:
Core library used in the projects of Sv443 and the Sv443 Network. Contains tons of miscellaneous QoL features.
15 lines (10 loc) • 415 B
JavaScript
const isClass = require("./isClass");
function allInstanceOf(arr, Class)
{
if(!Array.isArray(arr) || !isClass(Class))
throw new TypeError(`Parameters in allInstanceOf() are invalid. Expected array of any and class reference.`);
if(arr.length === 0)
return false;
return arr.reduce((a, c) => a + (c instanceof Class ? 0 : 1), 0) === 0;
}
module.exports = allInstanceOf;