https://github.com/Automattic/mongoose
Raw File
Tip revision: 6861d8df2b4d10b6ff691bf679e7c8c226e0e28d authored by Valeri Karpov on 16 April 2024, 16:29:51 UTC
chore: release 8.3.2
Tip revision: 6861d8d
getConstructorName.js
'use strict';

/**
 * If `val` is an object, returns constructor name, if possible. Otherwise returns undefined.
 * @api private
 */

module.exports = function getConstructorName(val) {
  if (val == null) {
    return void 0;
  }
  if (typeof val.constructor !== 'function') {
    return void 0;
  }
  return val.constructor.name;
};
back to top