https://github.com/Automattic/mongoose
Raw File
Tip revision: e1a6c0b2f4f322f9c692520e50444d2a993a5f68 authored by Valeri Karpov on 10 August 2022, 00:58:23 UTC
chore: release 6.5.2
Tip revision: e1a6c0b
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