Created
April 29, 2015 18:11
-
-
Save bryanforbes/ce23c275df6ba343c782 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var __decorate = this.__decorate || function (decorators, target, key, desc) { | |
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") return Reflect.decorate(decorators, target, key, desc); | |
switch (arguments.length) { | |
case 2: return decorators.reduceRight(function(o, d) { return (d && d(o)) || o; }, target); | |
case 3: return decorators.reduceRight(function(o, d) { return (d && d(target, key)), void 0; }, void 0); | |
case 4: return decorators.reduceRight(function(o, d) { return (d && d(target, key, o)) || o; }, desc); | |
} | |
}; | |
function enumerable(enumerable) { | |
if (enumerable === void 0) { enumerable = true; } | |
return function (target, propertyKey) { | |
Object.defineProperty(target, propertyKey, { | |
configurable: true, | |
writable: true, | |
enumerable: false | |
}); | |
}; | |
} | |
var MyClass = (function () { | |
function MyClass() { | |
this.property = 'initial value'; | |
} | |
__decorate([ | |
enumerable(false) | |
], MyClass.prototype, "property"); | |
return MyClass; | |
})(); | |
var mc = new MyClass(); | |
for (var key in mc) { | |
console.log(key); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function enumerable(enumerable: boolean = true): PropertyDecorator { | |
return function (target: Object, propertyKey: string): void { | |
Object.defineProperty(target, propertyKey, { | |
configurable: true, | |
writable: true, | |
enumerable: false | |
}); | |
}; | |
} | |
class MyClass { | |
@enumerable(false) | |
property: string = 'initial value'; | |
} | |
var mc = new MyClass(); | |
for (var key in mc) { | |
console.log(key); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment