{"size": 572, "ext": "js", "max_stars_repo_path": "public/plugins/collectjs/methods/search.js", "max_stars_repo_name": "lucassouzati/slacs", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "public/plugins/collectjs/methods/search.js", "max_issues_repo_name": "lucassouzati/slacs", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "public/plugins/collectjs/methods/search.js", "max_forks_repo_name": "lucassouzati/slacs", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 21.1851851852, "max_line_length": 67, "alphanum_fraction": 0.6136363636}
'use strict';

module.exports = function search(valueOrFunction, strict) {
  var valueFn = valueOrFunction;

  if (typeof valueOrFunction === 'function') {
    valueFn = this.items.filter(function (value, key) {
      return valueOrFunction(value, key);
    })[0];
  }

  var itemKey = this.items.filter(function (item) {
    if (strict === true) {
      return item === valueFn;
    }

    return item === Number(valueFn) || item === valueFn.toString();
  })[0];

  var index = this.items.indexOf(itemKey);

  if (index === -1) {
    return false;
  }

  return index;
};