{"size": 845, "ext": "js", "max_stars_repo_path": "lib/forEach.js", "max_stars_repo_name": "alexrevell/itrabble", "max_stars_repo_stars_event_min_datetime": "2018-05-03T15:57:30.000Z", "max_stars_repo_stars_event_max_datetime": "2021-06-04T06:56:19.000Z", "max_issues_repo_path": "lib/forEach.js", "max_issues_repo_name": "alexrevell/itrabble", "max_issues_repo_issues_event_min_datetime": "2020-11-20T03:03:43.000Z", "max_issues_repo_issues_event_max_datetime": "2020-11-20T03:03:45.000Z", "max_forks_repo_path": "lib/forEach.js", "max_forks_repo_name": "alexrevell/itrabble", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": 5, "max_issues_count": 1, "max_forks_count": null, "avg_line_length": 25.6060606061, "max_line_length": 82, "alphanum_fraction": 0.6414201183}
/**
 * Callback function that accepts two parameters
 * @function binaryCallback
 * @param {*} firstArg
 * @param {*} secondArg
 * @returns {*} result - result of firstArg and secondArg applied to callback.
 */

/**
 * Pass each item through callback function. Doesn't use return value of callback.
 *
 * @generator forEach
 * @param {binaryCallback} callback - The callback for each item and index.
 * @yields {*} item - the next item from the collection.
 *
 * @example <caption>Example usage of forEach to log items with index</caption>
 * itrabble([1,2,3]).forEach((x, index) => console.log(`${index}: ${x}`))
 * // logs:
 * // => 0: 1
 * // => 1: 2
 * // => 2: 3
 * // and yields 1, 2, 3
 */
function *forEach(callback) {
  let index = 0
  for (const item of this) {
    callback(item, index++)
    yield item
  }
}

export default forEach
