dot-object icon indicating copy to clipboard operation
dot-object copied to clipboard

Using dot.pick with proxy object

Open BartaG512 opened this issue 4 years ago • 0 comments

Currently pick does not work with proxies but maybe it could be extended like this:

index.js - 
DotObject.prototype.pick 
  - if (obj && typeof obj === 'object' && key in obj) {
  + if (obj && typeof obj === 'object' && Object.getOwnPropertyNames(obj).includes(key)) {

It works in the case if the proxy defines ownKeys() or getOwnPropertyDescriptor(target, key) methods. Or maybe it could be extended with an option flag for this case?

BartaG512 avatar Apr 01 '20 21:04 BartaG512