0

I want to extract a target object from Proxy. Is it possible?

let foo = new Proxy(bar, {...}) 
let extractedBar = ? // should be plain object, not Proxy

I know, I can make my own solution for this. But I wonder is there any standard implementation, so I won't have to edit Proxy's code.

Nurbol Alpysbayev
  • 19,522
  • 3
  • 54
  • 89
  • @CertainPerformance are you really serious? Did you ever read the question? I want to get *target* not *handler* – Nurbol Alpysbayev Jul 07 '18 at 03:19
  • The other question is not exactly the same, but the answer there *does* address what you're asking. `ECMAScript provides no way to access the internal [[ProxyHandler]] nor [[ProxyTarget]] slots.` – CertainPerformance Jul 07 '18 at 03:21
  • @CertainPerformance firstly, I don't think if questions are asking different things they should be marked duplicate, even if they may possibly have common answer. Secondly, I checked that question before, but it's answers didn't satisfy me. Thirdly, I was adding some info to the question when you marked it as a duplicate, and that info indicated, that answers from question you provided are not suitable (you were to fast, I was to slow). What should I do now, ask this question again? – Nurbol Alpysbayev Jul 07 '18 at 03:31
  • @CertainPerformance I see your last edit. Ok, now I understand. Thanks for pointing to exact piece of answer, I missed it (and hope it is true) – Nurbol Alpysbayev Jul 07 '18 at 03:34
  • I'd close as a duplicate of https://stackoverflow.com/questions/51096547/how-to-get-the-target-of-a-javascript-proxy, but it doesn't have an answer yet – Bergi Jul 07 '18 at 08:28

0 Answers0