UNPKG

589 BJavaScriptView Raw
1"use strict";
2
3Object.defineProperty(exports, "__esModule", {
4 value: true
5});
6exports.default = proxyObject;
7/**
8 * Proxy object if environment supported
9 */
10function proxyObject(obj, extendProps) {
11 if (typeof Proxy !== 'undefined' && obj) {
12 return new Proxy(obj, {
13 get: function get(target, prop) {
14 if (extendProps[prop]) {
15 return extendProps[prop];
16 }
17
18 // Proxy origin property
19 var originProp = target[prop];
20 return typeof originProp === 'function' ? originProp.bind(target) : originProp;
21 }
22 });
23 }
24 return obj;
25}
\No newline at end of file