Find an item in list.
556920
function find(list, predicate) { // eslint-disable-line consistent-return
  for (var i = 0, length = list.length, item; i < length; i++) {
    item = list[i];
    if (predicate(item)) {
      return item;
    }
  }
}
1107119
def count(self, item):
        """"""
        try:
            return self.items.get(item, 0)
        except TypeError:
            return self.items.get(repr(item), 0)
346672
def removeLT(self, item):
        """"""
        count = self.getCountLT(item)
        self._list = self._list[count:]
        return count
718780
def get_by(self, name):
    """"""
    return next((item for item in self if item.name == name), None)
407173
function(list, property) {
      if (_.isArray(list)) {
        return _.some(list, function(item) { return _.has(item, property); });
      } else {
        return _.has(list, property);
      }
    }
99916
function findFirstListItem(lineNumber, cm) {
  let nextLineNumber = lineNumber;
  let lineText = cm.getLine(lineNumber);

  while (listRE.test(lineText)) {
    nextLineNumber -= 1;
    lineText = cm.getLine(nextLineNumber);
  }

  if (lineNumber === nextLineNumber) {
    nextLineNumber = -1;
  } else {
    nextLineNumber += 1;
  }

  return nextLineNumber;
}
236844
def retrieve_by_id(self, id_):
        """"""
        items_with_id = [item for item in self if item.id == int(id_)]
        if len(items_with_id) == 1:
            return items_with_id[0].retrieve()
260753
def findItems(self, data, cls=None, initpath=None, **kwargs):
        
        # filter on cls attrs if specified
        if cls and cls.TAG and 'tag' not in kwargs:
            kwargs['etag'] = cls.TAG
        if cls and cls.TYPE and 'type' not in kwargs:
            kwargs['type'] = cls.TYPE
        # loop through all data elements to find matches
        items = []
        for elem in data:
            if self._checkAttrs(elem, **kwargs):
                item = self._buildItemOrNone(elem, cls, initpath)
                if item is not None:
                    items.append(item)
        return items
145467
def _findRow(subNo, model):
    """"""
    items = model.findItems(str(subNo))
    if len(items) == 0:
        return None
    if len(items) > 1:
        raise IndexError("Too many items with sub number %s" % subNo)
    return items[0].row()
815447
def get_item_by_key(passed_list, key, value):
    '''
    
    '''

    if value in [None, '']:
        return

    if type(passed_list) in [QuerySet, PolymorphicQuerySet]:
        sub_list = passed_list.filter(**{key: value})
    else:
        sub_list = [x for x in passed_list if x.get(key) == value]

    if len(sub_list) == 1:
        return sub_list[0]
    return sub_list
1275835
def find_or_create_by_name(self, item_name, items_list, item_type):
        
        item = self.find_by_name(item_name, items_list)
        if not item:
            item = self.data_lists[item_type][2](item_name, None)
        return item
741675
def find_item(name)
      items.find do |item|
        item.name == name ||
        item.short_name.gsub('…','') == name.gsub('…','')
      end
    end
837468
def doFindAll(self, WHAT={}, SORT=[], SKIP=None, MAX=None):
		""""""

		self._preFind(WHAT, SORT, SKIP, MAX)

		return self._doAction('-findall')
97639
def find_by_name(self, item_name, items_list, name_list=None):
        
        if not name_list:
            names = [item.name for item in items_list if item]
        else:
            names = name_list
        if item_name in names:
            ind = names.index(item_name)
            return items_list[ind]
        return False
224042
def _find_by_name(tree_data, name, is_dir, start_at):
    """"""
    try:
        item = tree_data[start_at]
        if item and item[2] == name and S_ISDIR(item[1]) == is_dir:
            tree_data[start_at] = None
            return item
    except IndexError:
        pass
    # END exception handling
    for index, item in enumerate(tree_data):
        if item and item[2] == name and S_ISDIR(item[1]) == is_dir:
            tree_data[index] = None
            return item
        # END if item matches
    # END for each item
    return None
536132
function findNext(array, item) {
  return array[(Util.findIndex(array, el => el === item) + 1) % array.length]
}
714604
function findIndex(list, predicate) {
  for (var i = 0, item; item = list[i]; i++)
    if (predicate(item)) return i;

  return -1;
}