'use strict';
define(function() {
  /**
   * TODO: Remove if useless, the same thing can be done natively :
   * (input|filter:{key : value})[0]
   *
   * Returns the object having the @key property equals to @value, null if nothing is found
   *
   * @returns input
   */
  var findObjectInArray = function() {
    return function(input, key, value) {
      for (var i = 0; i < input.length; i++) {
        if (input[i][key] == value) {
          return input[i];
        }
      }
      return null;
    };
  };

  findObjectInArray.$inject = [];
  return findObjectInArray;
});
