0

Hi I am attempting (horrendously) to access a value in an Object, the value is within what I believe is a descriptor, I believe this because it is shown when I console log the object like:

console.log(Object.getOwnPropertyDescriptors(Cognitive))     

This is shown:
enter image description here

The Value I am trying to access is module: {i: ..., l: true, ...
Within [[Scopes]]

I dont know what [[Scopes]] is and trying to execute the get function in the object and console.log the value returned seems to return the imported functions contents instead of the values shown in the get function in the image.

1 Answers1

1

About the scope array, [[Scopes]] Is an internal property from Chrome DevTools and it is currently not possible to access that using javascript, see: Access function location programmatically

And about getting the file location of the component that isnt possible yet, this is actually a javascript issue, see: ES6 get path of module inside module but you probably shouldn't do that on your application anyway.

Jorrmungandr
  • 107
  • 1
  • 6
  • Ah many thanks for a informative answer, my intentions were to route the component imported to the file path in react-router like such `` is there any such method? – Finbar Cowan Jun 01 '21 at 19:34
  • So you need to pass to that `path` the url path that is going in your browser, right? Not the component file path in the project – Jorrmungandr Jun 01 '21 at 20:47
  • Yes well my intentions are to pass the component file path as the url path in order to automate the process of routing all of my files since I intend to make alot of them. – Finbar Cowan Jun 07 '21 at 16:36