src/util.js
function internalSearchCheck (searchTerm, key, value, seen, depth) {
  let match = false
  let result
  if (key === '_custom') {
    key = value.display
    value = value.value
  }
  (result = specialTokenToString(value)) && (value = result)
  if (key && compare(key, searchTerm)) {
    match = true
    seen.set(value, true)
  } else if (seen.has(value)) {
    match = seen.get(value)
  } else if (Array.isArray(value)) {
    seen.set(value, null)
    match = internalSearchArray(value, searchTerm, seen, depth)
    seen.set(value, match)
  } else if (isPlainObject(value)) {
    seen.set(value, null)
    match = internalSearchObject(value, searchTerm, seen, depth)
    seen.set(value, match)
  } else if (compare(value, searchTerm)) {
    match = true
    seen.set(value, true)
  }
  return match
}
function internalSearchCheck (searchTerm, key, value, seen, depth) {
  let match = false
  let result
  if (key === '_custom') {
    key = value.display
    value = value.value
  }
  (result = specialTokenToString(value)) && (value = result)
  if (key && compare(key, searchTerm)) {
    match = true
    seen.set(value, true)
  } else if (seen.has(value)) {
    match = seen.get(value)
  } else if (Array.isArray(value)) {
    seen.set(value, null)
    match = internalSearchArray(value, searchTerm, seen, depth)
    seen.set(value, match)
  } else if (isPlainObject(value)) {
    seen.set(value, null)
    match = internalSearchObject(value, searchTerm, seen, depth)
    seen.set(value, match)
  } else if (compare(value, searchTerm)) {
    match = true
    seen.set(value, true)
  }
  return match
}
function internalSearchCheck ( searchTerm , key , value , seen , depth ) { let match = false let result if ( key === '_custom' ) { key = value . display value = value . value } ( result = specialTokenToString ( value ) ) && ( value = result ) if ( key && compare ( key , searchTerm ) ) { match = true seen . set ( value , true ) } else if ( seen . has ( value ) ) { match = seen . get ( value ) } else if ( Array . isArray ( value ) ) { seen . set ( value , null ) match = internalSearchArray ( value , searchTerm , seen , depth ) seen . set ( value , match ) } else if ( isPlainObject ( value ) ) { seen . set ( value , null ) match = internalSearchObject ( value , searchTerm , seen , depth ) seen . set ( value , match ) } else if ( compare ( value , searchTerm ) ) { match = true seen . set ( value , true ) } return match }
Checks if the provided field matches the search terms
@param {string} searchTerm Search string
@param {string} key Field key (null if from array)
@param {*} value Field value
@param {Map<any,boolean>} seen Map containing the search result to prevent stack overflow by walking on the same object multiple times
@param {number} depth Deep search depth level, which is capped to prevent performance issues
@returns {boolean} Search match
Checks if the provided field matches the search terms