It would be nice if you add ability to use numbers as name in whenTargetNamed and numbers/symbols as tag in whenTargetTagged
I want to use enums as names in whenTargetNamed. But current signature of this method allows only string values, so i can't use enums.
enum NodeTransformers {
CatchClauseObfuscator,
FunctionDeclarationObfuscator,
FunctionObfuscator
}
bind<INodeTransformer>(ServiceIdentifiers.INodeTransformer)
.to(CatchClauseObfuscator)
.whenTargetNamed(NodeTransformers.CatchClauseObfuscator);
bind<INodeTransformer>(ServiceIdentifiers.INodeTransformer)
.to(FunctionDeclarationObfuscator)
.whenTargetNamed(NodeTransformers.FunctionDeclarationObfuscator);
bind<INodeTransformer>(ServiceIdentifiers.INodeTransformer)
.to(FunctionObfuscator)
.whenTargetNamed(NodeTransformers.FunctionObfuscator);
Same with whenTargetTagged. It would be nice to use as tag numbers or symbols:
const tag: symbol = Symbol();
enum NodeTransformers {
CatchClauseObfuscator,
FunctionDeclarationObfuscator,
FunctionObfuscator
}
bind<INodeTransformer>(ServiceIdentifiers.INodeTransformer)
.to(CatchClauseObfuscator)
.whenTargetTagged(tag, NodeTransformers.CatchClauseObfuscator);
bind<INodeTransformer>(ServiceIdentifiers.INodeTransformer)
.to(FunctionDeclarationObfuscator)
.whenTargetTagged(tag, NodeTransformers.FunctionDeclarationObfuscator);
bind<INodeTransformer>(ServiceIdentifiers.INodeTransformer)
.to(FunctionObfuscator)
.whenTargetTagged(tag, NodeTransformers.FunctionObfuscator);
Sounds reasonable to me. Would you like to send a PR?
I can try to do it in weekend.
Cool I will be working in other issues first but If I finish them I will also work on this. I will comment here if I'm working on it...
I made some changes and update few tests but my MacBook Air just dying on that project so very hard to write additional tests, IDE is freezes.
https://github.com/sanex3339/InversifyJS/commit/2ef3c17d975ed56e39e83272a6c39c150640a801
I can make PR with this changes, but i think this changes should be covered by additional tests.
If you send a PR I will review it and take a look to the build and test coverage 馃憤
This has been now merged into master https://github.com/inversify/InversifyJS/pull/427
When i can expect beta version with this?
Released 馃帀

Amazing, thank you!
Most helpful comment
Released 馃帀
