Or `return index === -1 ? filename : filename.slice(0, index);`