source: frontend/node_modules/@sinonjs/commons/lib/class-name.js

Last change on this file was 9af201e, checked in by MBK <marija.karapandzova@…>, 12 days ago

Fix frontend appearance

  • Property mode set to 100644
File size: 921 bytes
Line 
1"use strict";
2
3var functionName = require("./function-name");
4
5/**
6 * Returns a display name for a value from a constructor
7 *
8 * @param {object} value A value to examine
9 * @returns {(string|null)} A string or null
10 */
11function className(value) {
12 return (
13 (value.constructor && value.constructor.name) ||
14 // The next branch is for IE11 support only:
15 // Because the name property is not set on the prototype
16 // of the Function object, we finally try to grab the
17 // name from its definition. This will never be reached
18 // in node, so we are not able to test this properly.
19 // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function/name
20 (typeof value.constructor === "function" &&
21 /* istanbul ignore next */
22 functionName(value.constructor)) ||
23 null
24 );
25}
26
27module.exports = className;
Note: See TracBrowser for help on using the repository browser.