module Jekyll::Algolia::Utils

def self.find_by_key(items, key, value)

It is basically a wrapper around [].find, handling more edge-cases

value - The value of the key to filter
key - The key to search for
items - The array of hashes to search

Public: Find an item from an array based on the value of one of its key
def self.find_by_key(items, key, value)
  return nil if items.nil?
  items.find do |item|
    item[key] == value
  end
end