Created
February 27, 2020 19:31
-
-
Save omarkdev/07d9ee26214637c6bfc2ce6a2ddb15f7 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
function enumerable(newValue: boolean) { | |
return ( | |
target: any, | |
propertyKey: string, | |
propertyDescriptor: PropertyDescriptor, | |
) => { | |
propertyDescriptor.enumerable = newValue; | |
} | |
} | |
class User { | |
name: string = 'Marcos'; | |
@enumerable(false) | |
changePassword(newPassword: string) { } | |
} | |
const user = new User(); | |
for (const key in user) { | |
console.log(key); | |
} | |
// name |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment