diff --git a/src/containers/layout/WordSearchFormComponent.tsx b/src/containers/layout/WordSearchFormComponent.tsx index 82cae75..f88d045 100644 --- a/src/containers/layout/WordSearchFormComponent.tsx +++ b/src/containers/layout/WordSearchFormComponent.tsx @@ -2,7 +2,7 @@ import React, {useState} from 'react' import IconSearchSVG from "../../components/svg/IconSearchSVG"; import posed from "react-pose"; import styled from "styled-components"; -import {debounce, includes, isEmpty, slice, startsWith} from "lodash" +import {debounce, isEmpty, slice} from "lodash" import {LATIN_IMLO_ARRAY} from "../../constants/latinWords"; interface IProps { @@ -151,9 +151,9 @@ export default function WordSearchFormComponent({}: IProps) { resolve(LATIN_IMLO_ARRAY.filter((word: string) => { if (searchValue) { if (searchPlace == 'any') { - return includes(word, searchValue) + return word.search(/searchValue/ig) > -1 } else { - return startsWith(word, searchValue) + return word.search(new RegExp('^' + searchValue, 'i')) > -1 } } })), @@ -181,6 +181,7 @@ export default function WordSearchFormComponent({}: IProps) {
debouncedKeyupListener(e.target.value, searchConfig.searchPlace)} />