https://github.com/Automattic/mongoose
Raw File
Tip revision: 70fa116eefce220901614378302b1233aff79934 authored by Valeri Karpov on 24 July 2023, 14:39:14 UTC
chore: release 7.4.1
Tip revision: 70fa116
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