Search by parts of Arabic word on JSON I've just implemented a search box, so I can search on employee object by (name, part of the name, phone, email ...).
Ex. if the name: Moamen Abdulraouf Mansour, I can search with ( moamen | moa | moamen mansour ...).
The Idea I've followed is:

split some values from the object to be not included in the search.
convert each object of the array to one string,
then replace extra spaces and some special Arabic letters with another letter (آ أ إ =&gt; ا) and so on.
then convert the search text string to an array of words.
After that, going through each object and find if it includes all words on the search text
finally, return this object to be the result.

the JSON looks:
{
      &quot;id&quot;: &quot;0&quot;,
      &quot;ORGANIZATION_NAME&quot;: &quot;ORGANIZATION NAME&quot;,
      &quot;ORGANIZATION_NAME_LINK&quot;: &quot;&lt;a href='...' target='_blank' title='..'&gt;....&lt;/a&gt;&quot;,
      &quot;ORGANIZATION_TYPE_CODE&quot;: &quot;MIN&quot;,
      &quot;ORGANIZATION_TYPE&quot;: &quot;type&quot;,
      &quot;pid&quot;: &quot;99999&quot;,
      &quot;ORIGINAL_ORGANIZATION_LEVEL&quot;: 0,
      &quot;DeptUrl&quot;: &quot;MI0&quot;,
      &quot;IsCreated&quot;: true,
      &quot;ManImageUrl&quot;: &quot;https://....jpg&quot;,
      &quot;EMPLOYEECODE&quot;: &quot;90000419&quot;,
      &quot;EMP_NO_ERP&quot;: &quot;90000419&quot;,
      &quot;TITLE&quot;: &quot;السيد&quot;,
      &quot;USER_FULL_NAME&quot;: &quot;employee name&quot;,
      &quot;USER_POSITION_TITLE&quot;: &quot;title&quot;,
      &quot;USER_EMAIL&quot;: &quot;..@domain.com&quot;,
      &quot;SEX_CODE&quot;: &quot;M&quot;,
      &quot;USER_EXTENSION&quot;: &quot;4999&quot;,
      &quot;USER_MOBILE&quot;: &quot;1234&quot;,
      &quot;USER_HOME_PHONE&quot;: &quot;1234&quot;
    },...

and this is the JS:
let searchBtn = document.getElementById('searchBtn');
let myList = document.getElementById('myList');
let arr = [];
let searchKeyword;
var resultsSize = 5;

async function getUserAsync(keywords) {
  let response = await fetch('http://localhost:3000/users');
  let data = await response.json();
  return data;
}

searchBtn.addEventListener('keyup', (e) =&gt; {
  // get serach text, remove spaces from start and end and remove more than one space between, then convert to array of words
  searchKeyword = e.target.value
    .replace(/\s+/g, ' ')
    .replace(/[\u0623|\u0622|\u0625]/g, 'ا')
    .replace(/[\u0649]/g, 'ي')
    .replace(/[\u0629]/g, 'ه')
    .trim()
    .split(' ');

  getUserAsync(searchKeyword).then((data) =&gt; {
    arr = data;

    if (searchKeyword[0].length &gt; 2) {
      let filtered = arr.filter(function (el) {
        let {
          id,
          DeptUrl,
          pid,
          IsCreated,
          TITLE,
          SEX_CODE,
          ManImageUrl,
          ORGANIZATION_TYPE,
          ORGANIZATION_TYPE_CODE,
          ORIGINAL_ORGANIZATION_LEVEL,
          fortags,
          ...rest
        } = el;

        let elCompind = Object.values(rest)
          .join()
          .replace(/\s+/g, ' ')
          .replace(/[\u0623|\u0622|\u0625]/g, 'ا')
          .replace(/[\u0649]/g, 'ي')
          .replace(/[\u0629]/g, 'ه');

        let checkAllWords = searchKeyword.map((item) =&gt; {
          return elCompind.includes(item);
        });

        return checkAllWords.includes(false) ? false : true;
      });
      appendFiltered(filtered.slice(0, resultsSize));
    } else {
      appendFiltered([]);
    }
  });
});

function appendFiltered(filteredArray) {
  // reset container HTML
  myList.innerHTML = '';

  filteredArray.forEach((element) =&gt; {
    // console.log(element);
    let node = document.createElement('div'); // Create a node

    node.innerHTML = `
      &lt;ul&gt;
        &lt;li&gt;${element.USER_FULL_NAME}&lt;/li&gt;
        &lt;li&gt;${element.ORGANIZATION_NAME}&lt;/li&gt;
        &lt;li&gt;${element.USER_EMAIL}&lt;/li&gt;
        &lt;li&gt;${element.USER_POSITION_TITLE}&lt;/li&gt;
      &lt;/ul&gt;
    `;
    myList.appendChild(node); // Append to body
  });
}

the code works well, but I believe this code can be improved.
You didn't post your HTML, but the element with the id searchBtn doesn't seem to be a button, so it shouldn't be called &quot;btn&quot; in it's id or variable name.
There are many variables that don't change their value, so you should be using const instead of let (or var).
The variables arr and searchKeyword are only used inside the event handler, so they should be declared in there and not outside.
The function getUserAsync doesn't use its parameter.
You should use the event input instead of keyup, because the value of the input can change without a keypress.
The same .replace calls are used on the keywords and the content being searched, so that should be extracted into their out function.
The requirement that only the first keyword must be longer than two characters seems a bit arbitrarily. The user won't get any results, even if there are more valid (longer) keywords, but they will get results from invalid (shorter) keywords if they are not in the first position. It probably would make more sense to filter out words shorter than three out of the list of keywords.
Using a deconstructing assignment to create variables that you don't use and in order to exclude certain object properties seems strange. It would probably make more sense to do something like:
const IGNORED_PROPERTIES = [&quot;id&quot;, &quot;DeptUrl&quot;, &quot;pid&quot; /* etc. */ ]; 
const elCompind = Object.entries(el)
  .filter(([k, v]) =&gt; !IGNORED_PROPERTIES.includes(k))
  .map(([k, v]) =&gt; v)
  .join()
  /* etc. */;

The expression checkAllWords.includes(false) ? false : true can be simplified to !checkAllWords.includes(false), however it is not necessary at all, because instead of mapping all keywords to a boolean and then checking of there is a false item, you can use the .every array method. This also has the advantage, that it will stop once a single false has been found and won't necessarily check more keywords:
return searchKeyword.every(item =&gt; elCompind.includes(item)});

(Also notice the simplified lambda.)