use more descriptive startsWith than indexOf

Co-Authored-By: MartinMuzatko <martin@happy-css.com>
This commit is contained in:
Alberto Maturano 2018-10-26 14:19:04 +02:00 committed by GitHub
parent 02edab8053
commit 7e87e7da97
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -64,7 +64,9 @@ export default {
if (res.length >= max) break
const p = pages[i]
// filter out results that do not match current version context
if (!~p.path.slice(1).indexOf(searchContext)) continue
if ( ! p.path.startsWith(searchContext, 1)) {
continue;
}
// filter out results that do not match current locale
if (this.getPageLocalePath(p) !== localePath) continue
if (matches(p)) {