You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

7 lines
371 B
JavaScript

"use strict";
module.exports = function isConstructor(value) {
/* TODO: This isn't great. Technically a regular function could have a non-empty prototype; and a constructor could have a prototype that *looks* empty but has a parent prototype that isn't. */
return (typeof value === "function" && value.prototype != null && Object.keys(value.prototype).length > 0);
};