https://github.com/Automattic/mongoose
Raw File
Tip revision: 17334785f52e001610200380f10416806c674910 authored by Valeri Karpov on 17 June 2024, 21:59:01 UTC
chore: release 8.4.3
Tip revision: 1733478
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