Add possibility to build classname based on string
See original GitHub issueI would really like the possibility to build a class name from a variable if the said variable is set. I encountered the issue when building classes for a standard Bootstrap alert box: in addition to the class alert
I also needed the string alert-<alert-type>
, but only if alert-type
is defined.
Issue Analytics
- State:
- Created 8 years ago
- Comments:9
Top Results From Across the Web
Create an instance of a class from a string - Stack Overflow
I'm trying to imagine a scenario where creating the object via class name and then casting it as that type would make any...
Read more >Best way to new up a class with only classname as a string
I know I can build a switch off of the model name, but in this case I'm hard coding the method to known...
Read more >The Basics - Manual - PHP
A class can inherit the constants, methods, and properties of another class by using the keyword extends in the class declaration. It is...
Read more >Java.lang.Class class in Java | Set 1 - GeeksforGeeks
The above statement creates the Class object for the class passed as a String argument(className). Note that the parameter className must be ...
Read more >How to Get Class Name in Python? - FavTutor
Another method is to use the type() method which is the in-built python method to find the type or the class name of...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
We’re using ES6’s computed values (Babel, of course):
@ojame of course, @oleronning this is definitely the way to do this. Lets not over-complicate this module with what is essentially a language hitch.
Thanks @ojame