module Jekyll::Filters

def find(input, property, value)

rubocop:disable Metrics/CyclomaticComplexity

Returns the found object or nil

their `#inspect` string object.
Cannot be an instance of Array nor Hash since calling #to_s on them returns
value - the desired value.
property - the property within each object to search by.
input - the object array.

with the given value or returns nil otherwise.
Search an array of objects and returns the first object that has the queried attribute
def find(input, property, value)
  return input if !property || value.is_a?(Array) || value.is_a?(Hash)
  return input unless input.respond_to?(:find)
  input    = input.values if input.is_a?(Hash)
  input_id = input.hash
  # implement a hash based on method parameters to cache the end-result for given parameters.
  @find_filter_cache ||= {}
  @find_filter_cache[input_id] ||= {}
  @find_filter_cache[input_id][property] ||= {}
  # stash or retrieve results to return
  # Since `enum.find` can return nil or false, we use a placeholder string "<__NO MATCH__>"
  #   to validate caching.
  result = @find_filter_cache[input_id][property][value] ||= input.find do |object|
    compare_property_vs_target(item_property(object, property), value)
  end || "<__NO MATCH__>"
  return nil if result == "<__NO MATCH__>"
  result
end