<commit_before>module.exports = function(type, x, y, opts) {
    var fullOpts = {
        bubbles: true,
        clientX: x,
        clientY: y
    };

    // https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent
    if(opts && opts.buttons) {
        fullOpts.buttons = opts.buttons;
    }

    var el = (opts && opts.element) || document.elementFromPoint(x, y),
        ev;

    if(type === 'scroll') {
        ev = new window.WheelEvent('wheel', Object.assign({}, fullOpts, opts));
    } else {
        ev = new window.MouseEvent(type, fullOpts);
    }

    el.dispatchEvent(ev);

    return el;
};<commit_msg>don't use Object.assign even in tests, just in case<commit_after>var Lib = require('@src/lib');

module.exports = function(type, x, y, opts) {
    var fullOpts = {
        bubbles: true,
        clientX: x,
        clientY: y
    };

    // https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent
    if(opts && opts.buttons) {
        fullOpts.buttons = opts.buttons;
    }

    var el = (opts && opts.element) || document.elementFromPoint(x, y),
        ev;

    if(type === 'scroll') {
        ev = new window.WheelEvent('wheel', Lib.extendFlat({}, fullOpts, opts));
    } else {
        ev = new window.MouseEvent(type, fullOpts);
    }

    el.dispatchEvent(ev);

    return el;
};
{'fraction_non_alphanumeric': 0.15660809778456838, 'fraction_numerical': 0.0, 'mean_word_length': 2.3418367346938775, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 2, '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': '6419680', 'n_tokens_mistral': 442, 'n_tokens_neox': 436, 'n_words': 93}