From 825648535c92683f9dc2af7f54742f7d28517f16 Mon Sep 17 00:00:00 2001 From: syuilo Date: Thu, 1 Nov 2018 21:01:47 +0900 Subject: [PATCH] Refactoring --- src/client/app/common/views/components/autocomplete.vue | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/client/app/common/views/components/autocomplete.vue b/src/client/app/common/views/components/autocomplete.vue index ea91655b2..a68b42935 100644 --- a/src/client/app/common/views/components/autocomplete.vue +++ b/src/client/app/common/views/components/autocomplete.vue @@ -193,18 +193,18 @@ export default Vue.extend({ }); emjdb.some(x => { - if (x.name.indexOf(this.q) == 0 && !x.alias && !matched.some(y => y.emoji == x.emoji)) matched.push(x); + if (x.name.startsWith(this.q) && !x.alias && !matched.some(y => y.emoji == x.emoji)) matched.push(x); return matched.length == max; }); if (matched.length < max) { emjdb.some(x => { - if (x.name.indexOf(this.q) == 0 && !matched.some(y => y.emoji == x.emoji)) matched.push(x); + if (x.name.startsWith(this.q) && !matched.some(y => y.emoji == x.emoji)) matched.push(x); return matched.length == max; }); } if (matched.length < max) { emjdb.some(x => { - if (x.name.indexOf(this.q) > -1 && !matched.some(y => y.emoji == x.emoji)) matched.push(x); + if (x.name.includes(this.q) && !matched.some(y => y.emoji == x.emoji)) matched.push(x); return matched.length == max; }); }