Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ability to collect defined metadata property names #65

Open
hlege opened this issue Mar 28, 2017 · 2 comments
Open

Ability to collect defined metadata property names #65

hlege opened this issue Mar 28, 2017 · 2 comments

Comments

@hlege
Copy link

hlege commented Mar 28, 2017

Is there a way to collect the decorated property names from a prototype without knowing the property names in advance?

It is a useful feature for an orm, ioc and other stuff.

Right know Reflect.getMetadataKeys(fn.prototype) returns an empty array. It would be useful to return the annotated property names if the second argument is undefined.
Maybe Reflect.getMetadataPropertyNames(fn.prototype)

Example:

 const fn:Function = ...;

 const propertyNames = Reflect.getMetadataKeys(fn.prototype);
 for (const name of propertyNames){
     const cachable = Reflect.hasMetadata("CachableMetaKey", fn.prototype, name);
     if (cachable) {
       //do stuff
     }
 }
@MichalLytek
Copy link

Ping @hlege, have you found a solution?
@rbuckton can you help us? 😉

@navels
Copy link

navels commented Sep 5, 2017

See #35

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants