There is a specific object in which the exact time of the properties is not known in advance. For example, the property name may be βAbCβ or βAbcβ or βabc,β etc.
However, I know that there is only one. That is, I know that there can be no property "AbC", as well as the property "abc".
The property name itself is case sensitive. Therefore, if it is stored as an Object.Abc object, and I am looking for aObject.abc, I will not find it.
My object can have 1000 of these properties.
It would be possible, but inefficient, if every time I wanted to perform a search, I compared the value of the lower case of the property I want to find with the smallest value of the property names, for example:
propertyName = inputValue.toLowerCase(); for (var i in theObject) { if (propertyName == i.toLowerCase());
Does anyone know a smarter way to do this?
For reasons that would take too long to explain, I can't just recreate the object and make all the properties more lowercase. I really understand that this is possible. I could just find
theObject['inputValue'.toLowerCase()]
directly. But, as I said, I canβt. Property names in an object are what they are, and they cannot be changed. Asking me why this would be a huge departure from the problem. Take my word for it, that the object is stuck with the names of the properties that it has.
Does anyone know an efficient way to search for a case-insensitive property name in such a situation?