dot-object
dot-object copied to clipboard
Using dot.pick with proxy object
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?