<commit_before>// rx streams require events to be replayed over time to make any sense.
export default function replaySteps(steps: any[], timeoutMax: number = 90) {
    if (steps.length > 0) {
        let head = steps[0];
        let headArg = undefined;
        let remaining = steps.slice(1);
        let timeout = Math.ceil(Math.random() * timeoutMax) + 10;
        if (typeof head === 'number') {
            timeout = head;
            head = remaining[0];
            remaining = remaining.slice(1);
        } else if (typeof head !== 'function') {
            let forObj = head;
            timeout = forObj.wait || timeout;
            if (forObj.for.length > 1) {
                remaining = [{
                    for: forObj.for.slice(1),
                    wait: forObj.wait,
                    fn: forObj.fn
                }].concat(remaining);
            }
            head = forObj.fn;
            headArg = forObj.for[0];
        }
        setTimeout(() => {
            head(headArg);
            replaySteps(remaining);
        }, timeout);
    }
    return;
}<commit_msg>Allow passing min timeout to replaySteps<commit_after>// rx streams require events to be replayed over time to make any sense.
export default function replaySteps(steps: any[], timeoutMax: number = 100, timeoutMin: number = 10) {
    if (steps.length > 0) {
        let head = steps[0];
        let headArg = undefined;
        let remaining = steps.slice(1);
        let timeout = Math.random() * timeoutMax + timeoutMin;
        if (typeof head === 'number') {
            timeout = head;
            head = remaining[0];
            remaining = remaining.slice(1);
        } else if (typeof head !== 'function') {
            let forObj = head;
            timeout = forObj.wait || timeout;
            if (forObj.for.length > 1) {
                remaining = [{
                    for: forObj.for.slice(1),
                    wait: forObj.wait,
                    fn: forObj.fn
                }].concat(remaining);
            }
            head = forObj.fn;
            headArg = forObj.for[0];
        }
        setTimeout(() => {
            head(headArg);
            replaySteps(remaining, timeoutMax, timeoutMin);
        }, timeout);
    }
    return;
}
{'fraction_non_alphanumeric': 0.11671087533156499, 'fraction_numerical': 0.011052166224580018, 'mean_word_length': 1.5455568053993252, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 9, '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': '2097868', 'n_tokens_mistral': 629, 'n_tokens_neox': 607, 'n_words': 170}