毕设专用git仓库
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

16 lines
584 B

import inspectObject from './object.js';
const toStringTag = typeof Symbol !== 'undefined' && Symbol.toStringTag ? Symbol.toStringTag : false;
export default function inspectClass(value, options) {
let name = '';
if (toStringTag && toStringTag in value) {
name = value[toStringTag];
}
name = name || value.constructor.name;
// Babel transforms anonymous classes to the name `_class`
if (!name || name === '_class') {
name = '<Anonymous Class>';
}
options.truncate -= name.length;
return `${name}${inspectObject(value, options)}`;
}