Closed zoobot closed 5 years ago
Can you elaborate on why you need to dynamically reference the name of a function, inside itself? You wrote the name “testNAME”, so you could write it in the code too?
In this case you could even use testNAME.name
Closing; happy to reopen with some more information.
Hi I am looking for a replacement for arguments.callee.name and they referred me here.
Was wondering if you can add stack.name to Object.getOwnPropertyDescriptor(new Error(), 'stack') { value, writable, enumerable, configurable, name }
arguments.callee.name: testNAME
Object.getOwnPropertyDescriptor(new Error(), 'stack'): [object Object]
Object.getOwnPropertyDescriptor(new Error(), 'stack'): { value: [32m'Error\n at testNAME (/mnt/tb/TB-warehouse-automation/test5.js:7:118)\n at Object. (/mnt/tb/TB-warehouse-automation/test5.js:14:1)\n at Module._compile (internal/modules/cjs/loader.js:689:30)\n at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10)\n at Module.load (internal/modules/cjs/loader.js:599:32)\n at tryModuleLoad (internal/modules/cjs/loader.js:538:12)\n at Function.Module._load (internal/modules/cjs/loader.js:530:3)\n at Function.Module.runMain (internal/modules/cjs/loader.js:742:12)\n at startup (internal/bootstrap/node.js:266:19)\n at bootstrapNodeJSCore (internal/bootstrap/node.js:596:3)'[39m,
writable: [33mtrue[39m,
enumerable: [33mfalse[39m,
configurable: [33mtrue[39m }
Object.getOwnPropertyDescriptor(new Error(), 'stack'): [32m'testNAME (/mnt/tb/TB-warehouse-automation/test5.js:9:118)\n at Object. (/mnt/tb/TB-warehouse-automation/test5.js:14:1)\n at Module._compile (internal/modules/cjs/loader.js:689:30)\n at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10)\n at Module.load (internal/modules/cjs/loader.js:599:32)\n at tryModuleLoad (internal/modules/cjs/loader.js:538:12)\n at Function.Module._load (internal/modules/cjs/loader.js:530:3)\n at Function.Module.runMain (internal/modules/cjs/loader.js:742:12)\n at startup (internal/bootstrap/node.js:266:19)\n at bootstrapNodeJSCore (internal/bootstrap/node.js:596:3)'[39m