Skip to content

Commit

Permalink
fix: error with empty search input
Browse files Browse the repository at this point in the history
  • Loading branch information
Seli0303 committed Jun 25, 2024
1 parent 842bd71 commit e4fd2bb
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/fragments/forms/place-input/place-input.js
Original file line number Diff line number Diff line change
Expand Up @@ -322,9 +322,13 @@ export default {
const regEx = new RegExp(searchMask, 'ig')
let localPlaceName = this.localModel.placeName
let replaceMask
//return early if placeName is empty and nothing needs to be highlighted
if(localPlaceName === ''){
return placeName.trim()
}
if ((placeName.toLowerCase()).indexOf(this.localModel.placeName.toLowerCase() + ' ') === 0) {
localPlaceName = localPlaceName[0].toUpperCase() + localPlaceName.substring(1) + ' '
} else if ((placeName.toLowerCase()).indexOf(this.localModel.placeName.toLowerCase()) === 0 ) {
} else if ((placeName.toLowerCase()).indexOf(this.localModel.placeName.toLowerCase()) === 0) {
localPlaceName = localPlaceName[0].toUpperCase() + localPlaceName.substring(1)
} else if ((placeName.toLowerCase()).indexOf(this.localModel.placeName.toLowerCase()) > 0 ) {
localPlaceName = ' ' + localPlaceName[0].toUpperCase() + localPlaceName.substring(1)
Expand Down

0 comments on commit e4fd2bb

Please sign in to comment.