I have the following function:
normalize = (input) => {
return input
.toLowerCase()
.normalize('NFD')
.replace(/[\u0300-\u036f]/g, '')
.replace(/\ı/g, "i");
}
and I use it as follows:
let places = [{
"name": "haci osman"
}, {
"name": "sample 2"
}, {
"name": "sample 3"
}];
let candidate = {
"placeName": "Hacı osman"
};
let exists = (places|| []).some(place=> this.normalize(candidate?.placeName).includes(this.normalize(place.name)));
items
and candidate
are fethed from API. This works perfectly on my local machine, but fails on the customer environment. At this point, I'm too blind to figure out what I'm missing. I expect the exists
variable to be equal to true
on the server/customer environment as well, but it is not. Why?
normalize = (input) => {
return input
.toLowerCase()
.normalize('NFD')
.replace(/[\u0300-\u036f]/g, '')
.replace(/\ı/g, "i");
}
let places = [{
"name": "haci osman"
}, {
"name": "sample 2"
}, {
"name": "sample 3"
}];
let candidate = {
"placeName": "Hacı osman"
};
let exists = (places|| []).some(place=> this.normalize(candidate?.placeName).includes(this.normalize(place.name)));
console.log(exists);