function index(a, fn) {
  var i, l;

  for (i = 0, l = a.length; i < l; i++) {
    if (fn(a[i])) return i;
  }

  return -1;
}
Function returning the index of the first element of a list matching the
given predicate.

@param  {array}     a  - The target array.
@param  {function}  fn - The predicate function.
@return {mixed}        - The index of the first matching item or -1.