|
|
@@ -33,7 +33,10 @@ export const isString = val => typeof val === 'string';
|
|
|
export const getOwnProp = (obj, key, defVal) => {
|
|
|
// obj may be a Proxy that throws in has() or its getter throws
|
|
|
try {
|
|
|
- if (hasOwnProperty(obj, key)) defVal = obj[key];
|
|
|
+ // hasOwnProperty is Reflect.has which throws for non-objects
|
|
|
+ if (obj && typeof obj === 'object' && hasOwnProperty(obj, key)) {
|
|
|
+ defVal = obj[key];
|
|
|
+ }
|
|
|
} catch (e) { /* NOP */ }
|
|
|
return defVal;
|
|
|
};
|