https://github.com/Automattic/mongoose
Raw File
Tip revision: ec4191ee9c3b641ab4005b119c6949002088bcb1 authored by Valeri Karpov on 09 January 2024, 16:35:42 UTC
chore: release 8.0.4
Tip revision: ec4191e
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