make component names case insensitive. ie: getComponent("fooBaR")
See original GitHub issueThe plugin system exposes a way to get components via system.getComponent().
Up till now its been case sensitive. Unfortunately we never put in a style-guide on what case to use.
So we have lowercase, TitleCase components mixed throughout.
I propose we make them case-insensitive.
- When building the system, we store the downcased name of the component in our object.
- When fetching, we downcase the argument to getComponent in order to fetch it from our object.
eg:
//...
plugins = [ { components: { wONderBAR: () => <h1> Hi </h1> } } ]
// stored as { wonderbar: .... }
system.getComponent("wonderBAR") // the component keyed with "wonderbar"
This is to allow any case, and not break any existing code. That said, we should likely normalize the component names in this codebase to be consistent.
Guestimate of work effort: < Normal
@shockey your thoughts?
Issue Analytics
- State:
- Created 6 years ago
- Reactions:3
- Comments:9 (6 by maintainers)
Top Results From Across the Web
[Request] Option for case insensitive search - HydrogenAudio
2) Double click on part of the band name, Ctrl+C ... However just the 'case insensitive' search may also do.
Read more >c preprocessor - Case insensitive #define - Stack Overflow
The reason behind this is that I want to #define some fortran subroutines to have different names, and they of course are case...
Read more >Style Guide - Vue.js
Component names should always be multi-word, except for root App ... However, mixed case filenames can sometimes create issues on case-insensitive file ...
Read more >case-insensitive - IBM
For a case-sensitive match when the value for the value command is ^foo , only values that start with foo match. In other...
Read more >11.5. Package Case-Sensitivity - CLISP - SourceForge
For example, with case sensitive symbols, the symbols cdr (the function ... when printing the SYMBOL-NAME part of a SYMBOL (i.e. the part...
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

hey @devthehuman … the file ( and function, I think ) you’re after lies here… https://github.com/swagger-api/swagger-ui/blob/master/src/core/system.js#L285
That function wraps deepExtend, which is how we combine plugins into one largish object. The code to be added there would look something like…
There is likely a prettier way, but that’s the safest area to add the code, as it’s run when we add stuff to the system ( ie: the big object ).
Hope that helps. Stick some console.logs in there to see the stuff that goes through it 😃
I think this is a very good idea 😄