refactor(compiler): use Object.keys instead of Object.getOwnPropertyNames (#10498)

This commit is contained in:
Marc Laval
2016-08-04 19:35:41 +02:00
committed by Alex Rickabaugh
parent fd19671c07
commit cd18de7a21
11 changed files with 19 additions and 23 deletions

View File

@ -114,14 +114,14 @@ function _serializeReference(ref: any, references: Map<any, string>): string {
function _valueProps(obj: any): string[] {
const props: string[] = [];
// regular public props
Object.getOwnPropertyNames(obj).forEach((prop) => {
Object.keys(obj).forEach((prop) => {
if (!prop.startsWith('_')) {
props.push(prop);
}
});
// getters
const proto = Object.getPrototypeOf(obj);
Object.getOwnPropertyNames(proto).forEach((protoProp) => {
Object.keys(proto).forEach((protoProp) => {
var desc = Object.getOwnPropertyDescriptor(proto, protoProp);
if (!protoProp.startsWith('_') && desc && 'get' in desc) {
props.push(protoProp);