@berish/serber
Version:
Serializable and deserializable adaptive adapter with plugins
31 lines • 934 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
// tslint:disable: no-conditional-assignment
// tslint:disable: triple-equals
const linq_1 = require("@berish/linq");
function getKeys(obj) {
try {
const dontEnums = [
'toString',
'toLocaleString',
'valueOf',
'hasOwnProperty',
'isPrototypeOf',
'propertyIsEnumerable',
'constructor',
];
let props = linq_1.default.from([]);
do {
props = props.concat(Object.getOwnPropertyNames(obj));
} while ((obj = Object.getPrototypeOf(obj)) && obj != Object.prototype);
return props
.orderByAscending(m => m)
.distinct()
.except(dontEnums);
}
catch (e) {
return linq_1.default.from(Object.keys(obj));
}
}
exports.getKeys = getKeys;
//# sourceMappingURL=getKeys.js.map