💾isClass()

JSvaluescustom functions ⟩ isClass()

check if value is a class. (Note:class is also a Function)

// ⭐️ check if value is a "class"
// - require: 
//   • isFunction()
//   • functionDefinition()
function isClass(value) {
    return (
        // `value` is a function
        isFunction(value) &&
        // `value` is a "class" definition
        functionDefinition(value).startsWith("class")
    );
}

Last updated