Imagine a scenario where we have models ABC23x, ABC23X & abc23X all referring to the same model. These model names are retrieved from API endpoints.
Now the UI has two tasks:
- Display only one model name (ABC23X)
- When calling the REST API, we need to send all possible values ([ABC23x, ABC23X, abc23X])
I am seeking assistance in implementing this feature. I attempted using MAP but it did not work as expected.
let models = ['tc75X', 'TC75X', 'tc75x', 'TC75x', 'TC76x', 'TC77Y'];
let mappedModels = new Map(models.map(s => [s.toUpperCase(), s]));
console.log(mappedModels);
Here is the fiddle
I am using Angular 6. Any assistance or suggestions would be greatly appreciated.