https://github.com/Automattic/mongoose
Raw File
Tip revision: 38865dfe4b7b1e2c0440a5ea60d14b149e574ece authored by Valeri Karpov on 05 July 2022, 14:54:34 UTC
chore: release 6.4.3
Tip revision: 38865df
getConstructorName.js
'use strict';

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

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