<commit_before>/**
 * Utility functions.
 */

export const isArray = Array.isArray;

export function isObject(obj) {
    return obj !== null && typeof obj === 'object';
}

export function forEach(collection, callback) {
    Object.keys(collection || {}).forEach(key => {
        callback.call(null, collection[key], key);
    });
}
<commit_msg>add findexIndex()<commit_after>/**
 * Utility functions.
 */

export const isArray = Array.isArray;

export function isObject(obj) {
    return obj !== null && typeof obj === 'object';
}

export function forEach(collection, callback) {
    Object.keys(collection || {}).forEach(key => {
        callback.call(null, collection[key], key);
    });
}

/**
 * Array.findIndex() polyfill.
 */
if (!Array.prototype.findIndex) {
    Object.defineProperty(Array.prototype, 'findIndex', {

        value(predicate) {

            if (this == null) {
                throw new TypeError('"this" is null or not defined');
            }

            if (typeof predicate !== 'function') {
                throw new TypeError('predicate must be a function');
            }

            var o = Object(this);
            var len = o.length >>> 0;
            var thisArg = arguments[1];
            var k = 0;

            while (k < len) {

                var kValue = o[k];

                if (predicate.call(thisArg, kValue, k, o)) {
                    return k;
                }

                k++;
            }

            return -1;
        }

    });
}

{'fraction_non_alphanumeric': 0.14285714285714285, 'fraction_numerical': 0.0026702269692923898, 'mean_word_length': 1.8606870229007633, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 8, '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': '5642479', 'n_tokens_mistral': 436, 'n_tokens_neox': 415, 'n_words': 109}