<commit_before>//= require ./object
//= require ./array

(function ($) {
    "use strict";

    // closure (private static attribute)
    var
        instances = [];

    Object.defineProperties($.prototype, {
        singleton: {
            value: function singleton () {
                var
                    self = this,
                    // apply pega o array (object) passado e o converte para uma
                    // lista de argumentos (flatten), evitando, assim, que o
                    // objeto arguments encapsule outro objeto arguments
                    constructor = Function.prototype.bind
                        .apply(self, [null].concat(arguments).flatten()),
                    i;

                for (i in instances) {
                    if (instances.hasOwnProperty(i)) {
                        if (instances[i].object instanceof constructor) {
                            if (arguments.flatten()
                                .isEquivalent(instances[i].args)) {
                                (function () {
                                    return instances[i];
                                })();
                            }
                        }

                    }
                }

                instances.push({
                    object: new constructor(),
                    args: arguments.flatten()
                });
                return instances.last();
            }
        }
    });

})(Function);<commit_msg>ajusta singleton<commit_after>//= require ./object
//= require ./array

(function ($) {
    "use strict";

    // closure (private static attribute)
    var
        instances = [];

    Object.defineProperties($.prototype, {
        singleton: {
            value: function singleton () {
                var
                    self = this,
                    // apply pega o array (object) passado e o converte para uma
                    // lista de argumentos (flatten), evitando, assim, que o
                    // objeto arguments encapsule outro objeto arguments
                    constructor = Function.prototype.bind
                        .apply(self, [null].concat(arguments).flatten()),
                    i;

                for (i in instances) {
                    if (instances.hasOwnProperty(i)) {
                        if (instances[i].object instanceof constructor) {
                            if (arguments.flatten()
                                .isEquivalent(instances[i].args)) {
                                (function () {
                                    return instances[i];
                                })();
                                // talvez isso funcione
                                // return instances[i].object;
                            }
                        }

                    }
                }

                instances.push({
                    object: new constructor(),
                    args: arguments.flatten()
                });
                return instances.last().object;
            }
        }
    });

})(Function);
{'fraction_non_alphanumeric': 0.09571382533032549, 'fraction_numerical': 0.0, 'mean_word_length': 0.9219814241486068, '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': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5445036', 'n_tokens_mistral': 703, 'n_tokens_neox': 642, 'n_words': 159}