UNPKG

is-class-component

Version:
46 lines (37 loc) 1.17 kB
(function (global, factory) { typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() : typeof define === 'function' && define.amd ? define(factory) : (global = global || self, global.isClassComponent = factory()); }(this, (function () { 'use strict'; /* -------------------- * is-it-type module * Entry point * ------------------*/ function isFunction(arg) { return isType('function', arg); } function isType(type, arg) { return getType(arg) === type; } /* * Helpers */ function getType(arg) { return typeof arg; } /* -------------------- * is-class-component module * Entry point * ------------------*/ /** * Determine if input is a React class component. * Input must have already been checked that it's a function before calling this. * @param {Function} Component - Function * @return {boolean} - true if is a React class component */ function isClassComponent(input) { return isFunction(input) && !!(input.prototype && input.prototype.isReactComponent); } return isClassComponent; }))); //# sourceMappingURL=is-class-component.js.map