<commit_before>doQuery = function(query){
    var collection = [],
        query = document.querySelectorAll(query);
    if(query.length > 0) {
        query.map(function(e) {
            collection.push(e);
        });
    }
    return collection;
}


isArray = function(obj){
    if(obj.constructor == Array)
        return true;
    return false;
}

// Array.prototype.less = function() {
//     var
//         _arr = this;

//     _arr
// }


// retorna a quantidade de um item
Array.prototype.occurrences = function(comparison) {
    var
        _arr = this.sort();
        count = 0;
    ;

    // talvez fosse interessante não usar o map para otimizar, testando até determinado item se diferente do próximo
    _arr.map(function(item) {
        if(item === comparison) { count++; }
    });
    return count;
}

Array.prototype.css = function(attr, value) {
    var collection = this;
    if(attr.constructor === Object) {
        var attrs = attr;
        collection.map(function(e) {
            for(i in attrs){
                if( attrs.hasOwnProperty(i) ){
                    e.style[i] = attr[i];
                }
            }
        });
    } else {
        collection.map(function(e) {
            e.style[attr] = value;
        });
    }
    return this;
}

Array.prototype.destroy = function() {
    var
        _a = this,
        i = 0,
        index = -1
    ;

    for(i in arguments) {
        // um método privado destroyAll poderá ser criado também
        while(true) {
            index = _a.indexOf(arguments[i]);
            if(index > -1) {
                destroyItem(_a, index);
            } else {
                break;
            }
        }
    }

    return _a;
}

Array.prototype.without = function() {
    var
        _a = this,
        i = 0,
        index = -1
    ;

    for(i in arguments) {
        while(true) {
            index = _a.indexOf(arguments[i]);
            if(index > -1) {
                _a = removeItem(_a, index);
            } else {
                break;
            }
        }
    }

    return _a;
}

var destroyItem = function(_arr, index) {
    _arr.splice(index, 1);
    return _arr;
}

var removeItem = function(_arr, index) {
    var _new = [];

    array.map(function (v, i){
        if (i !== index ){
            _new.push(v);
        }
    });

    return _new;
}

HTMLElement.prototype.next = function() {
    return this.nextElementSibling;
}

Array.prototype.prev = function(selector) {
    var collection = [];

    this.map(function(e) {
        if(e.previousElementSibling){
            collection.push(e.previousElementSibling);
        }
    });
    return collection;
}

//
HTMLElement.prototype.is = function(selector) {
    var obj = this;

    if(selector.charAt(0) === ':'){
        switch(selector) {
            case ':hidden':
                if(obj.style.display === 'none') {
                    return true;
                }
                break;
        }
    } else {
        if(document.querySelector(selector)) {
            return true;
        }
    }

    return false;
}

Array.prototype.parents = function(nodeName){
    var _parents = [],
        collection = this,
        parent = null;

    collection.map(function(e) {
        parent = e.parentNode;
        if(nodeName) {
            if(parent.nodeName.toLowerCase() === nodeName) {
                _parents.push(parent);
            } else {
                while(true) {
                    parent = parent.parentNode;
                    if(parent){
                        if(parent.nodeName.toLowerCase() === nodeName) {
                            _parents.push(parent);
                            break;
                        }
                    } else {
                        break;
                    }
                }
            }
        } else {
            if(parent){
                _parents.push(parent);
            }
        }
    });

    return _parents;
}
<commit_msg>adiciona método min a array<commit_after>doQuery = function(query){
    var collection = [],
        query = document.querySelectorAll(query);
    if(query.length > 0) {
        query.map(function(e) {
            collection.push(e);
        });
    }
    return collection;
}


isArray = function(obj){
    if(obj.constructor == Array)
        return true;
    return false;
}


Array.prototype.min = function() {
    return Math.min.apply(null, this);
}

// Array.prototype.less = function() {
//     var
//         _arr = this;

//     _arr
// }

// retorna a quantidade de um item
Array.prototype.occurrences = function(comparison) {
    var
        _arr = this.sort();
        count = 0;
    ;

    // talvez fosse interessante não usar o map para otimizar, testando até determinado item se diferente do próximo
    _arr.map(function(item) {
        if(item === comparison) { count++; }
    });
    return count;
}

Array.prototype.css = function(attr, value) {
    var collection = this;
    if(attr.constructor === Object) {
        var attrs = attr;
        collection.map(function(e) {
            for(i in attrs){
                if( attrs.hasOwnProperty(i) ){
                    e.style[i] = attr[i];
                }
            }
        });
    } else {
        collection.map(function(e) {
            e.style[attr] = value;
        });
    }
    return this;
}

Array.prototype.destroy = function() {
    var
        _a = this,
        i = 0,
        index = -1
    ;

    for(i in arguments) {
        // um método privado destroyAll poderá ser criado também
        while(true) {
            index = _a.indexOf(arguments[i]);
            if(index > -1) {
                destroyItem(_a, index);
            } else {
                break;
            }
        }
    }

    return _a;
}

Array.prototype.without = function() {
    var
        _a = this,
        i = 0,
        index = -1
    ;

    for(i in arguments) {
        while(true) {
            index = _a.indexOf(arguments[i]);
            if(index > -1) {
                _a = removeItem(_a, index);
            } else {
                break;
            }
        }
    }

    return _a;
}

var destroyItem = function(_arr, index) {
    _arr.splice(index, 1);
    return _arr;
}

var removeItem = function(_arr, index) {
    var _new = [];

    array.map(function (v, i){
        if (i !== index ){
            _new.push(v);
        }
    });

    return _new;
}

HTMLElement.prototype.next = function() {
    return this.nextElementSibling;
}

Array.prototype.prev = function(selector) {
    var collection = [];

    this.map(function(e) {
        if(e.previousElementSibling){
            collection.push(e.previousElementSibling);
        }
    });
    return collection;
}

//
HTMLElement.prototype.is = function(selector) {
    var obj = this;

    if(selector.charAt(0) === ':'){
        switch(selector) {
            case ':hidden':
                if(obj.style.display === 'none') {
                    return true;
                }
                break;
        }
    } else {
        if(document.querySelector(selector)) {
            return true;
        }
    }

    return false;
}

Array.prototype.parents = function(nodeName){
    var _parents = [],
        collection = this,
        parent = null;

    collection.map(function(e) {
        parent = e.parentNode;
        if(nodeName) {
            if(parent.nodeName.toLowerCase() === nodeName) {
                _parents.push(parent);
            } else {
                while(true) {
                    parent = parent.parentNode;
                    if(parent){
                        if(parent.nodeName.toLowerCase() === nodeName) {
                            _parents.push(parent);
                            break;
                        }
                    } else {
                        break;
                    }
                }
            }
        } else {
            if(parent){
                _parents.push(parent);
            }
        }
    });

    return _parents;
}

{'fraction_non_alphanumeric': 0.1220241804811168, 'fraction_numerical': 0.0024928331048236323, 'mean_word_length': 1.3461988304093566, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 9, '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': '6181975', 'n_tokens_mistral': 2376, 'n_tokens_neox': 2319, 'n_words': 467}