<commit_before>/* @flow */

type Callback = (now: number) => void;

export default function(): Object {
  let allCallbacks = [];
  let prevTime = 0;

  const now = () => prevTime;

  const raf = (cb: Callback) => {
    allCallbacks.push(cb);
  };

  const defaultTimeInterval = 1000 / 60;
  const _step = ms => {
    const allCallbacksBefore = allCallbacks;
    allCallbacks = [];

    prevTime += ms;
    allCallbacksBefore.forEach(cb => cb(prevTime));
  };

  const step = (howMany = 1, ms = defaultTimeInterval) => {
    for (let i = 0; i < howMany; i++) {
      _step(ms);
    }
  };

  return {now, raf, step};
}
<commit_msg>Implement rAF mock return correctly<commit_after>/* @flow */

type Callback = (now: number) => void;

export default function(): Object {
  let allCallbacks = [];
  let prevTime = 0;
  let id = 0;

  const now = () => prevTime;

  const raf = (cb: Callback) => {
    allCallbacks.push(cb);
    return id++;
  };

  const defaultTimeInterval = 1000 / 60;
  const _step = ms => {
    const allCallbacksBefore = allCallbacks;
    allCallbacks = [];

    prevTime += ms;
    allCallbacksBefore.forEach(cb => cb(prevTime));
  };

  const step = (howMany = 1, ms = defaultTimeInterval) => {
    for (let i = 0; i < howMany; i++) {
      _step(ms);
    }
  };

  return {now, raf, step};
}

{'fraction_non_alphanumeric': 0.15613099771515612, 'fraction_numerical': 0.014470677837014471, 'mean_word_length': 2.8533724340175954, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 15, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2604115', 'n_tokens_mistral': 479, 'n_tokens_neox': 448, 'n_words': 123}