I basicly need to do some replace logic to change the '.' to a '>' at here everything fine, i can just use the replace method from javascript, but i am searching the best way to do it.
Basicly i will use this function just for 1 specific task nothing more, i want to do this replace logic to my Name propertiy and description inside the object, so instead of doing a simple method that does the replace i need to pass it two times down.
At the moment i have this repeated: element.Name.replace('.', ' > ')
i created a method, but i thaught as the best possible way to maybe pass it to the function like: replaceMethod(firstProp,secondProp) where each prop gets replaced, so how can i inside the replace method just apply the same logic to all my arguments without using a useless for loop?
something like this:
replaceMethod(firstProp,secondProp) {
allArgs.replace('.', ' > ')
}
i did this:
callerFunc() {
// service get the object material, it has a name and description with '.'
replaceMethod(material,material.Name,material.Description)
// do some logic after the method with the material }
replaceMethod(material,...keys) {
keys.forEach(k => material[k] = material[k].replace(/\./g, ' > '));
}