I need to check if current URL includes a few substrings. My code works but I need a tip if it possible to make it better. I realize that duplicating code is not a good practice. I am working with Angular 6/Typescript/ECMAScript 6.
const currentUrl = this.location.path();
const displayTile = currentUrl.includes('/search-resources') || currentUrl.includes('/calendar') || currentUrl.includes('/yearbooks')? 1 : 2;