lib/utils.js
function findWhere (array, obj) {
  var props = Object.keys(obj);
  for (var i = 0; i < array.length; i++) {
    var passable = true;
    for (var j = 0; j < props.length; j++) {
      if (array[i][props[j]] !== obj[props[j]]) {
        passable = false;
      }
    }
    if (passable)
      return array[i];
  }
  return null;
}
function findWhere (array, obj) {
  var props = Object.keys(obj);
  for (var i = 0; i < array.length; i++) {
    var passable = true;
    for (var j = 0; j < props.length; j++) {
      if (array[i][props[j]] !== obj[props[j]]) {
        passable = false;
      }
    }
    if (passable)
      return array[i];
  }
  return null;
}
function findWhere ( array , obj ) { var props = Object . keys ( obj ) ; for ( var i = 0 ; i < array . length ; i ++ ) { var passable = true ; for ( var j = 0 ; j < props . length ; j ++ ) { if ( array [ i ] [ props [ j ] ] !== obj [ props [ j ] ] ) { passable = false ; } } if ( passable ) return array [ i ] ; } return null ; }
Finds an object in `array` that matches all key-value pairs
defined in `obj`. Returns first object that matches. Similar to
underscore's `_.findWhere`.

@param {Array} array
@param {Object} obj
@return {Mixed}
Finds an object in array that matches all key - value pairs defined in obj . Returns first object that matches . Similar to underscore s _ . findWhere .