frontend
The Case Against Over-Abstracting Front-End Code
Two pieces of code looking similar doesn't prove they should share an abstraction. They may be doing different jobs that happen to look alike today.
I prefer waiting until the repeated behaviour is clear. Then I can give the shared part a name that describes something real, rather than passing flags to account for every difference. Copying a few lines is sometimes a much smaller commitment than creating a new API.