I have two functions in my angular project, one is aceitaProposta that does this:
aceitaProposta() {
this.aceita();
// some other code
}
and I have recusaProposta:
recusaProposta() {
this.recusa();
// some other code
}
Now, the only difference between this.recusa and this.aceita is that the first one increments a property and the second one decrement it. I want to know if there's a way that I can transform these two functions into one function only using something like if to identify if its decrementing or incrementing. This way I would call the same function in both aceitaProposta and recusaProposta. Example:
aceitaProposta() {
this.incrementDecrement();
// some other code
}
recusaProposta() {
this.incrementDecrement();
// some other code
}
this.add(1),this.add(-1).