iwmlib/lib/3rdparty/systemjs/babel-helpers/get.js

24 lines
567 B
JavaScript
Raw Permalink Normal View History

2019-04-05 10:09:27 +02:00
export default (function get(object, property, receiver) {
if (object === null) object = Function.prototype;
var desc = Object.getOwnPropertyDescriptor(object, property);
if (desc === undefined) {
var parent = Object.getPrototypeOf(object);
if (parent === null) {
return undefined;
} else {
return get(parent, property, receiver);
}
} else if ("value" in desc) {
return desc.value;
} else {
var getter = desc.get;
if (getter === undefined) {
return undefined;
}
return getter.call(receiver);
}
});