is-ctor.js 253 B

1234567891011
  1. /**
  2. * Returns true if the given value
  3. * is a constructor function or a class.
  4. *
  5. * @param {*} value
  6. * @returns {boolean}
  7. */
  8. export function isCtor(value) {
  9. if (!value) return false;
  10. return typeof value === 'function' && 'prototype' in value;
  11. }