blog

Check if function is a class

const isClass = (fn) => {
return typeof fn === 'function' && /^\s*class\s+/.test(fn.toString());
}

Adapted from here: https://stackoverflow.com/a/30760236/2382115