The problem with this way of doing it is we're re-$parsing every iteration through the loop.

It might also be smart to cache parsed expressions that are used more than once? Or am I just being crazy?  I just want efficiency - I'm using this in a mobile app on some pretty big collections :-).  We could use angular `$cacheFactory` to limit the cache to like 30 expressions.

Here's a way that uses one function for both and only $parses once.  It's kind of long, but it is more efficient too.

```js
/* function checkValue
 * @param item - item we're going to pass to check
 * @param check - {string|function} - if string, will be $parsed to function
 * @param value - value to compare `check(item)` against for passing
 * @param compareMode - tells how to compare items: By reference, value, or for truthiness. 
 * @returns true or false - whether item passes check
 */
var COMPARE_REF = 1;
var COMPARE_VALUE = 2;
var COMPARE_TRUTHY = 3;
function checkValue(item, check, value, compareMode) {
  if (compareMode === COMPARE_REF) {
    return check(item) === value;
  } else if (compareMode === COMPARE_VALUE) {
    return check(item) == value;
  }
  return check(item);
}

function where(expr, value, deepCompare, onlyFirst) {
  var compareMode;
  if ( angular.isString(expr) ) {
    expr = $parse(expr);
    compareMode = deepCompare ? COMPARE_VALUE : COMPARE_REF;
  } else {
    compareMode = COMPARE_TRUTHY;
  }

  //We do a different for loop depending on onlyFirst so that
  //we dont' have to do an `if (onlyFirst)` inside each check.
  if (onlyFirst) {
    for (var i=0; i<this.array.length; i++) {
      if ( checkValue(item, expr, value, compareMode) ) {
        return this.array[i];
      }
    }
    return void 0;
  } else {
    var result = [];
    for (var i=0; i<this.array.length; i++) {
      if ( checkValue(item, expr, value, compareMode) ) {
        result.push(this.array[i]);
      }
    }
    return result;
  }
} 
function find(expr, value, deepCompare) {
  return where(expr, value, deepCompare, true);
}
```


  
}
```