function-name.js 711 B

1234567891011121314151617
  1. var DESCRIPTORS = require('../internals/descriptors');
  2. var hasOwn = require('../internals/has-own-property');
  3. var FunctionPrototype = Function.prototype;
  4. // eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
  5. var getDescriptor = DESCRIPTORS && Object.getOwnPropertyDescriptor;
  6. var EXISTS = hasOwn(FunctionPrototype, 'name');
  7. // additional protection from minified / mangled / dropped function names
  8. var PROPER = EXISTS && (function something() { /* empty */ }).name === 'something';
  9. var CONFIGURABLE = EXISTS && (!DESCRIPTORS || (DESCRIPTORS && getDescriptor(FunctionPrototype, 'name').configurable));
  10. module.exports = {
  11. EXISTS: EXISTS,
  12. PROPER: PROPER,
  13. CONFIGURABLE: CONFIGURABLE
  14. };