UNPKG

670 BJavaScriptView Raw
1"use strict";
2Object.defineProperty(exports, "__esModule", { value: true });
3const is_fakeable_1 = require("./is-fakeable");
4const is_native_prototype_1 = require("./is-native-prototype");
5function gatherProps(thing) {
6 const props = {};
7 while (is_fakeable_1.default(thing) && !is_native_prototype_1.default(thing)) {
8 Object.getOwnPropertyNames(thing).forEach((propName) => {
9 if (!props[propName] && propName !== 'constructor') {
10 props[propName] = Object.getOwnPropertyDescriptor(thing, propName);
11 }
12 });
13 thing = Object.getPrototypeOf(thing);
14 }
15 return props;
16}
17exports.default = gatherProps;