lib/utils.js
function singleIndexOf(arr, v) {
  var pos = -1;
  var i, l;
  if (!arr) {
    return -1;
  }
  for (i = 0, l = arr.length; i < l; i++) {
    if (arr[i] === v) {
      if (pos >= 0) {
        return -2;
      }
      pos = i;
    }
  }
  return pos;
}
function singleIndexOf(arr, v) {
  var pos = -1;
  var i, l;
  if (!arr) {
    return -1;
  }
  for (i = 0, l = arr.length; i < l; i++) {
    if (arr[i] === v) {
      if (pos >= 0) {
        return -2;
      }
      pos = i;
    }
  }
  return pos;
}
function singleIndexOf ( arr , v ) { var pos = - 1 ; var i , l ; if ( ! arr ) { return - 1 ; } for ( i = 0 , l = arr . length ; i < l ; i ++ ) { if ( arr [ i ] === v ) { if ( pos >= 0 ) { return - 2 ; } pos = i ; } } return pos ; }
Find index of value in array.

@param arr {Array} Can also be a false-ish value.
@param v {Object} Value to find.

Returns -1 if not found, -2 if found multiple times.
Find index of value in array .