Skip to content

Instantly share code, notes, and snippets.

View light-flight's full-sized avatar

Georgy Yuriev light-flight

View GitHub Profile
import { Controller } from '@hotwired/stimulus';
export default class extends Controller {
static targets = ['filterOption', 'filterList'];
#compareOptions(searchText, a, b) {
const aText = a.textContent.toLowerCase();
const bText = b.textContent.toLowerCase();
const aIndex = aText.indexOf(searchText);
const bIndex = bText.indexOf(searchText);