<commit_before>"use strict";

var arrayProto = require("@sinonjs/commons").prototypes.array;
var behavior = require("./behavior");
var behaviors = require("./default-behaviors");
var createProxy = require("./proxy");
var hasOwnProperty = require("@sinonjs/commons").prototypes.object.hasOwnProperty;
var isNonExistentOwnProperty = require("./util/core/is-non-existent-own-property");
var spy = require("./spy");
var extend = require("./util/core/extend");
var getPropertyDescriptor = require("./util/core/get-property-descriptor");
var isEsModule = require("./util/core/is-es-module");
var wrapMethod = require("./util/core/wrap-method");
var stubEntireObject = require("./stub-entire-object");
var throwOnFalsyObject = require("./throw-on-falsy-object");
var valueToString = require("@sinonjs/commons").valueToString;

var forEach = arrayProto.forEach;
var pop = arrayProto.pop;
var slice = arrayProto.slice;
var sort = arrayProto.sort;

var uuid = 0;

function createStub(arity) {
    var functionStub = function() {
        var args = slice(arguments);
        var matchings = functionStub.matchingFakes(args);

        var fnStub =
            pop(
                sort(matchings, function(a, b) {
                    return a.matchingArguments.length - b.matchingArguments.length;
                })
            ) || functionStub;
        return getCurrentBehavior(fnStub).invoke(this, arguments);
    };

    functionStub = createProxy(functionStub, arity);
    // Inherit spy API:
    extend(functionStub, spy);
    // Inherit stub API:
    extend(functionStub, stub);

    extend.nonEnum(functionStub, {
        instantiateFake: createStub,
        displayName: "stub",
        defaultBehavior: null,
        behaviors: [],
        id: "stub#" + uuid++
    });

    return functionStub;
}

function stub(object, property) {
    if (arguments.length > 2) {
        throw new TypeError("stub(obj, 'meth', fn) has been removed, see documentation");
    }

    if (isEsModule(object)) {<commit_msg>refactor: Prefer function statement<commit_after>"use strict";

var arrayProto = require("@sinonjs/commons").prototypes.array;
var behavior = require("./behavior");
var behaviors = require("./default-behaviors");
var createProxy = require("./proxy");
var hasOwnProperty = require("@sinonjs/commons").prototypes.object.hasOwnProperty;
var isNonExistentOwnProperty = require("./util/core/is-non-existent-own-property");
var spy = require("./spy");
var extend = require("./util/core/extend");
var getPropertyDescriptor = require("./util/core/get-property-descriptor");
var isEsModule = require("./util/core/is-es-module");
var wrapMethod = require("./util/core/wrap-method");
var stubEntireObject = require("./stub-entire-object");
var throwOnFalsyObject = require("./throw-on-falsy-object");
var valueToString = require("@sinonjs/commons").valueToString;

var forEach = arrayProto.forEach;
var pop = arrayProto.pop;
var slice = arrayProto.slice;
var sort = arrayProto.sort;

var uuid = 0;

function createStub(arity) {
    var proxy;

    function functionStub() {
        var args = slice(arguments);
        var matchings = proxy.matchingFakes(args);

        var fnStub =
            pop(
                sort(matchings, function(a, b) {
                    return a.matchingArguments.length - b.matchingArguments.length;
                })
            ) || proxy;
        return getCurrentBehavior(fnStub).invoke(this, arguments);
    }

    proxy = createProxy(functionStub, arity);
    // Inherit spy API:
    extend(proxy, spy);
    // Inherit stub API:
    extend(proxy, stub);

    extend.nonEnum(proxy, {
        instantiateFake: createStub,
        displayName: "stub",
        defaultBehavior: null,
        behaviors: [],
        id: "stub#" + uuid++
    });

    return proxy;
}

function stub(object, property) {
    if (arguments.length > 2) {
        throw new TypeError("stub(obj, 'meth', fn) has been removed, see documentation");
    }

    if (isEsModule(object)) {
{'fraction_non_alphanumeric': 0.14149523331660813, 'fraction_numerical': 0.0010035122930255895, 'mean_word_length': 3.2824919441460794, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, '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': '3466474', 'n_tokens_mistral': 1182, 'n_tokens_neox': 1183, 'n_words': 258}