<commit_before>/**
 * @file Function methods polyfill
 * @since 0.1.5
 */
/*#ifndef(UMD)*/
"use strict";
/*global _gpfInstallCompatibility*/ // Define and install compatible methods
/*exported _gpfJsCommentsRegExp*/ // Find all JavaScript comments
/*#endif*/

var _gpfArrayPrototypeSlice = Array.prototype.slice;

_gpfInstallCompatibility("Function", {
    on: Function,

    methods: {

        // Introduced with JavaScript 1.8.5
        bind: function (thisArg) {
            var me = this,
                prependArgs = _gpfArrayPrototypeSlice.call(arguments, 1);
            return function () {
                var args = _gpfArrayPrototypeSlice.call(arguments, 0);
                me.apply(thisArg, prependArgs.concat(args));
            };
        }

    }

});

//region Function name

// Get the name of a function if bound to the call
var _gpfJsCommentsRegExp =  new RegExp("//.*$|/\\*(?:[^\\*]*|\\*[^/]*)\\*/", "gm");
function _gpfGetFunctionName () {
    // Use simple parsing
    /*jshint validthis:true*/
    var functionSource = Function.prototype.toString.call(this), //eslint-disable-line no-invalid-this
        functionKeywordPos = functionSource.indexOf("function"),
        parameterListStartPos = functionSource.indexOf("(", functionKeywordPos);
    return functionSource
            .substr(functionKeywordPos + 9, parameterListStartPos - functionKeywordPos - 9)
            .replace(_gpfJsCommentsRegExp, "") // remove comments
            .trim();
}
<commit_msg>FIX #110<commit_after>/**
 * @file Function methods polyfill
 * @since 0.1.5
 */
/*#ifndef(UMD)*/
"use strict";
/*global _gpfInstallCompatibility*/ // Define and install compatible methods
/*global _gpfFunc*/ // Create a new function using the source
/*global _gpfBuildFunctionParameterList*/ // Builds an array of parameters
/*exported _gpfJsCommentsRegExp*/ // Find all JavaScript comments
/*#endif*/

var _gpfArrayPrototypeSlice = Array.prototype.slice;

function _generateBindBuilderSource (length) {
    return [
        "var me = this;",
        "return function (" + _gpfBuildFunctionParameterList(length).join(", ") + ") {",
        "   var args = _gpfArrayPrototypeSlice.call(arguments, 0);",
        "    return me.apply(thisArg, prependArgs.concat(args));",
        "};"
    ].join("\n");
}

_gpfInstallCompatibility("Function", {
    on: Function,

    methods: {

        // Introduced with JavaScript 1.8.5
        bind: function (thisArg) {
            var me = this,
                prependArgs = _gpfArrayPrototypeSlice.call(arguments, 1),
                builderSource = _generateBindBuilderSource(Math.max(this.length - prependArgs.length, 0));
            return _gpfFunc(["thisArg", "prependArgs", "_gpfArrayPrototypeSlice"], builderSource)
                .call(me, thisArg, prependArgs, _gpfArrayPrototypeSlice);
        }

    }

});

//region Function name

// Get the name of a function if bound to the call
var _gpfJsCommentsRegExp =  new RegExp("//.*$|/\\*(?:[^\\*]*|\\*[^/]*)\\*/", "gm");
function _gpfGetFunctionName () {
    // Use simple parsing
    /*jshint validthis:true*/
    var functionSource = Function.prototype.toString.call(this), //eslint-disable-line no-invalid-this
        functionKeywordPos = functionSource.indexOf("function"),
        parameterListStartPos = functionSource.indexOf("(", functionKeywordPos);
    return functionSource
            .substr(functionKeywordPos + 9, parameterListStartPos - functionKeywordPos - 9)
            .replace(_gpfJsCommentsRegExp, "") // remove comments
            .trim();
}

{'fraction_non_alphanumeric': 0.1365427927927928, 'fraction_numerical': 0.006756756756756757, 'mean_word_length': 2.9086908690869087, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '1438637', 'n_tokens_mistral': 1048, 'n_tokens_neox': 1024, 'n_words': 238}