<commit_before>/*
ListJS with beta 1.0.0
By <NAME> (www.jonnystromberg.com, www.listjs.com)
*/
(function( window, undefined ) {
"use strict";

var document = window.document,
    events = require('events'),
    getByClass = require('get-by-class'),
    extend = require('extend');

var List = function(id, options, values) {

    var self = this,
		init,
        Item = require('./src/item')(self),
        addAsync = require('./src/add-async')(self),
        parse = require('./src/parse')(self);

    this.listClass      = "list";
    this.searchClass    = "search";
    this.sortClass      = "sort";
    this.page           = 200;
    this.i              = 1;
    this.items          = [];
    this.visibleItems   = [];
    this.matchingItems  = [];
    this.searched       = false;
    this.filtered       = false;
    this.handlers       = { 'updated': [] };

    extend(this, options);

    this.listContainer = (typeof(id) === 'string') ? document.getElementById(id) : id;
    if (!this.listContainer) { return; }
    this.list           = getByClass(this.listContainer, this.listClass, true);

    this.templater      = require('./src/templater')(self);
    this.sort           = require('./src/sort')(self);
    this.search         = require('./src/search')(self);
    this.filter         = require('./src/filter')(self);

    init = {
        start: function(values) {
            this.callbacks();
            parse(self.list);
            if (values !== undefined) {
                self.add(values);
            }
            self.update();
            //this.plugins(options.plugins);
        },
        callbacks: function() {
            events.bind(getByClass(self.listContainer, this.searchClass), 'keyup', self.search);
            /*
            for (var i in self.handlers) {
                self.on(i, self.handlers[i]);
            }
            */
        },
        plugins: function(plugins) {
            for (var i = 0; i < plugins.length; i++) {
                plugins[i][1] = plugins[i][1] || {};
                var pluginName = plugins[i][1].name || plugins[i][0];
                self[pluginName] = self.plugins[plugins[i][0]].call(self, plugins[i][1]);
            }
        }
    };


    /*
    * Add object to list
    */
    this.add = function(values, callback) {
        if (callback) {
            addAsync(values, callback);
            return;
        }
        var added = [],
            notCreate = false;
        if (values[0] === undefined){
            values = [values];
        }
        for (var i = 0, il = values.length; i < il; i++) {
            var item = null;
            if (values[i] instanceof Item) {<commit_msg>Remove callback from init, their handled by their components<commit_after>/*
ListJS with beta 1.0.0
By <NAME> (www.jonnystromberg.com, www.listjs.com)
*/
(function( window, undefined ) {
"use strict";

var document = window.document,
    events = require('events'),
    getByClass = require('get-by-class'),
    extend = require('extend');

var List = function(id, options, values) {

    var self = this,
		init,
        Item = require('./src/item')(self),
        addAsync = require('./src/add-async')(self),
        parse = require('./src/parse')(self);

    this.listClass      = "list";
    this.searchClass    = "search";
    this.sortClass      = "sort";
    this.page           = 200;
    this.i              = 1;
    this.items          = [];
    this.visibleItems   = [];
    this.matchingItems  = [];
    this.searched       = false;
    this.filtered       = false;
    this.handlers       = { 'updated': [] };

    extend(this, options);

    this.listContainer = (typeof(id) === 'string') ? document.getElementById(id) : id;
    if (!this.listContainer) { return; }
    this.list           = getByClass(this.listContainer, this.listClass, true);

    this.templater      = require('./src/templater')(self);
    this.sort           = require('./src/sort')(self);
    this.search         = require('./src/search')(self);
    this.filter         = require('./src/filter')(self);

    init = {
        start: function(values) {
            parse(self.list);
            if (values !== undefined) {
                self.add(values);
            }
            self.update();
            //this.plugins(options.plugins);
        },
        plugins: function(plugins) {
            for (var i = 0; i < plugins.length; i++) {
                plugins[i][1] = plugins[i][1] || {};
                var pluginName = plugins[i][1].name || plugins[i][0];
                self[pluginName] = self.plugins[plugins[i][0]].call(self, plugins[i][1]);
            }
        }
    };


    /*
    * Add object to list
    */
    this.add = function(values, callback) {
        if (callback) {
            addAsync(values, callback);
            return;
        }
        var added = [],
            notCreate = false;
        if (values[0] === undefined){
            values = [values];
        }
        for (var i = 0, il = values.length; i < il; i++) {
            var item = null;
            if (values[i] instanceof Item) {
{'fraction_non_alphanumeric': 0.15934065934065933, 'fraction_numerical': 0.006279434850863423, 'mean_word_length': 1.7626016260162602, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 4, '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': '2024838', 'n_tokens_mistral': 1540, 'n_tokens_neox': 1492, 'n_words': 310}