https://github.com/Automattic/mongoose
Raw File
Tip revision: 57b6eab733e19b6c1409f43dce20ac2208e7190f authored by Valeri Karpov on 22 August 2023, 11:37:15 UTC
chore: release 7.4.4
Tip revision: 57b6eab
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