<commit_before>/*!
 * TableExport.js 4.0.0-alpha.4 (https://www.travismclarke.com)
 * Copyright 2017 <NAME>
 * Licensed under the MIT license
 */

;(function (root, factory) {
    if (typeof define === 'function' && define.amd) {
        // AMD. Register as an anonymous module.
        define(['exports', 'jquery', 'blobjs', 'file-saverjs', 'xlsx-js'], factory);
    } else if (typeof exports === 'object' && typeof exports.nodeName !== 'string') {
        // CommonJS
        factory(exports, require('jquery'), require('blobjs'), require('file-saverjs'), require('xlsx-js'));
    } else {
        // Browser globals
        factory(root, root.jQuery, root.Blob, root.saveAs, root.XLSX);
    }
}(this, function (exports, $, Blob, saveAs, XLSX) {
        'use strict';
        /**
         * TableExport main plugin constructor
         * @param selectors {jQuery} jQuery selector(s)
         * @param options {Object} TableExport configuration options
         * @param isUpdate {Boolean}
         * @constructor
         */
        var TableExport = function (selectors, options, isUpdate) {

            var self = this;
            /**
             * TableExport configuration options (user-defined w/ default fallback)
             */
            self.settings = isUpdate ? options : _extend({}, TableExport.prototype.defaults, options);
            /**
             * jQuery selectors (tables) to apply the plugin to
             */
            self.selectors = _nodesArray(selectors);

            var rowD = TableExport.prototype.rowDel,
                ignoreRows = self.settings.ignoreRows instanceof Array ? self.settings.ignoreRows : [self.settings.ignoreRows],
                ignoreCols = self.settings.ignoreCols instanceof Array ? self.settings.ignoreCols : [self.settings.ignoreCols],
                ignoreCSS = self.settings.ignoreCSS instanceof Array ? self.settings.ignoreCSS.join(", ") : self.settings.ignoreCSS,
                emptyCSS = self.settings.emptyCSS instanceof Array ? self.settings.emptyCSS.join(", ") : self.settings.emptyCSS,
                formatValue = TableExport.prototype.formatValue.bind(this, self.settings.trimWhitespace),
                getType = TableExport.prototype.getType,
                bootstrapClass, bootstrapTheme, bootstrapSpacing;

            if (self.settings.bootstrap) {
                bootstrapClass = TableExport.prototype.bootstrap[0] + " ";
                bootstrapTheme = TableExport.prototype.bootstrap[1] + " ";
                bootstrapSpacing = TableExport.prototype.bootstrap[2] + " ";
            } else {
                bootstrapClass = TableExport.prototype.defaultButton + " ";
                bootstrapTheme = bootstrapSpacing = "";
            }

            self.selectors.forEach(function (el) {
                var caption = el.querySelectorAll('caption:not(.head)');
                isUpdate && caption.parentNode.removeChild(caption);

                var rows = _nodesArray(el.querySelectorAll('tbody > tr')),
                    rows = self.settings.headings ? _nodesArray(el.querySelectorAll("thead > tr")).concat(rows) : rows,
                    rows = self.settings.footers ? _nodesArray(el.querySelectorAll("tfoot > tr")).concat(rows) : rows,
                    thAdj = self.settings.headings ? el.querySelectorAll('thead > tr').length : 0,
                    filename = self.settings.filename === "id" ? (el.getAttribute('id') ? el.getAttribute('id') : TableExport.prototype.defaultFilename) : self.settings.filename,
                    exporters = {
                        xlsx: function (rDel, name) {
                            var rcMap = {},
                                dataURL = _nodesArray(rows).map(function (val, ir) {
                                    if (!!~ignoreRows.indexOf(ir - thAdj) || _hasClass(val, ignoreCSS)) {
                                        return;
                                    }
                                    var cols = val.querySelectorAll('th, td');
                                    return _nodesArray(cols).map(function (val, ic) {
                                        if (!!~ignoreCols.indexOf(ic) || _hasClass(val, ignoreCSS)) {
                                            return;
                                        }
                                        if (_hasClass(val, emptyCSS)) {
                                            return " "
                                        }
                                        if (val.hasAttribute('colspan')) {
                                            rcMap[ir] = rcMap[ir] || {};
                                            rcMap[ir][ic + 1] = val.getAttribute('colspan') - 1
                                        }
                                        if (val.hasAttribute('rowspan')) {
                                            for (var i = 1; i < val.getAttribute('rowspan'); i++) {
                                                rcMap[ir + i] = rcMap[ir + i] || {};
                                                rcMap[ir + i][ic] = 1
                                            }
                                        }
                                        if (rcMap[ir]) {
                                            var threshold = ic + 1,
                                                total = 0,
                                                count = 0;

                                            for (var i = 0; i <= Math.max.apply(Math, Object.keys(rcMap[ir])); i++) {
                                                (!rcMap[ir][i]) ? count++ : total = count >= ic ? total + rcMap[ir][i] : total;
                                                if (count === threshold) {
                                                    break;
                                                }
                                            }
                                            return new Array(total).concat($(val).text());
                                        }
                                        return formatValue(val.textContent);
                                    });
                                }),
                                dataObject = TableExport.prototype.escapeHtml(
                                    JSON.stringify({
                                        data: dataURL,
                                        filename: name,
                                        mimeType: TableExport.prototype.xlsx.mimeType,
                                        fileExtension: TableExport.prototype.xlsx.fileExtension
                                    })),
                                myContent = TableExport.prototype.xlsx.buttonContent,
                                myClass = TableExport.prototype.xlsx.defaultClass;
                            createObjButton(dataObject, myContent, myClass);
                        },
                        xlsm: function (rDel, name) {
                            var rcMap = {},
                                dataURL = _nodesArray(rows).map(function (val, ir) {
                                    if (!!~ignoreRows.indexOf(ir - thAdj) || _hasClass(val, ignoreCSS)) {
                                        return;
                                    }
                                    var cols = val.querySelectorAll('th, td');
                                    return _nodesArray(cols).map(function (val, ic) {
                                        if (!!~ignoreCols.indexOf(ic) || _hasClass(val, ignoreCSS)) {
                                            return;
                                        }
                                        if (_hasClass(val, emptyCSS)) {
                                            return " "
                                        }
                                        if (val.hasAttribute('colspan')) {
                                            rcMap[ir] = rcMap[ir] || {};
                                            rcMap[ir][ic + 1] = val.getAttribute('colspan') - 1
                                        }
                                        if (val.hasAttribute('rowspan')) {
                                            for (var i = 1; i < val.getAttribute('rowspan'); i++) {
                                                rcMap[ir + i] = rcMap[ir + i] || {};
                                                rcMap[ir + i][ic] = 1
                                            }
                                        }
                                        if (rcMap[ir]) {
                                            var threshold = ic + 1,
                                                total = 0,
                                                count = 0;

                                            for (var i = 0; i <= Math.max.apply(Math, Object.keys(rcMap[ir])); i++) {
                                                (!rcMap[ir][i]) ? count++ : total = count >= ic ? total + rcMap[ir][i] : total;
                                                if (count === threshold) {
                                                    break;
                                                }
                                            }
                                            return new Array(total).concat($(val).text());
                                        }
                                        return formatValue(val.textContent);
                                    });
                                }),
                                dataObject = TableExport.prototype.escapeHtml(
                                    JSON.stringify({
                                        data: dataURL,
                                        filename: name,
                                        mimeType: TableExport.prototype.xls.mimeType,
                                        fileExtension: TableExport.prototype.xls.fileExtension
                                    })),
                                myContent = TableExport.prototype.xls.buttonContent,
                                myClass = TableExport.prototype.xls.defaultClass;
                            createObjButton(dataObject, myContent, myClass);
                        },
                        xls: function (rdel, name) {
                            var colD = TableExport.prototype.xls.separator,
                                dataURL = _nodesArray(rows).map(function (val, i) {
                                    if (!!~ignoreRows.indexOf(i - thAdj) || _hasClass(val, ignoreCSS)) {
                                        return;
                                    }
                                    var cols = val.querySelectorAll('th, td');
                                    return _nodesArray(cols).map(function (val, i) {
                                        if (!!~ignoreCols.indexOf(i) || _hasClass(val, ignoreCSS)) {
                                            return;
                                        }
                                        if (_hasClass(val, emptyCSS)) {
                                            return " "
                                        }
                                        return formatValue(val.textContent);
                                    }).join(colD);
                                }).join(rdel),
                                dataObject = TableExport.prototype.escapeHtml(
                                    JSON.stringify({
                                        data: dataURL,
                                        filename: name,
                                        mimeType: TableExport.prototype.xls.mimeType,<commit_msg>implement "getType"<commit_after>/*!
 * TableExport.js 4.0.0-alpha.4 (https://www.travismclarke.com)
 * Copyright 2017 <NAME>
 * Licensed under the MIT license
 */

;(function (root, factory) {
    if (typeof define === 'function' && define.amd) {
        // AMD. Register as an anonymous module.
        define(['exports', 'jquery', 'blobjs', 'file-saverjs', 'xlsx-js'], factory);
    } else if (typeof exports === 'object' && typeof exports.nodeName !== 'string') {
        // CommonJS
        factory(exports, require('jquery'), require('blobjs'), require('file-saverjs'), require('xlsx-js'));
    } else {
        // Browser globals
        factory(root, root.jQuery, root.Blob, root.saveAs, root.XLSX);
    }
}(this, function (exports, $, Blob, saveAs, XLSX) {
        'use strict';
        /**
         * TableExport main plugin constructor
         * @param selectors {jQuery} jQuery selector(s)
         * @param options {Object} TableExport configuration options
         * @param isUpdate {Boolean}
         * @constructor
         */
        var TableExport = function (selectors, options, isUpdate) {

            var self = this;
            /**
             * TableExport configuration options (user-defined w/ default fallback)
             */
            self.settings = isUpdate ? options : _extend({}, TableExport.prototype.defaults, options);
            /**
             * jQuery selectors (tables) to apply the plugin to
             */
            self.selectors = _nodesArray(selectors);

            var rowD = TableExport.prototype.rowDel,
                ignoreRows = self.settings.ignoreRows instanceof Array ? self.settings.ignoreRows : [self.settings.ignoreRows],
                ignoreCols = self.settings.ignoreCols instanceof Array ? self.settings.ignoreCols : [self.settings.ignoreCols],
                ignoreCSS = self.settings.ignoreCSS instanceof Array ? self.settings.ignoreCSS.join(", ") : self.settings.ignoreCSS,
                emptyCSS = self.settings.emptyCSS instanceof Array ? self.settings.emptyCSS.join(", ") : self.settings.emptyCSS,
                formatValue = TableExport.prototype.formatValue.bind(this, self.settings.trimWhitespace),
                getType = TableExport.prototype.getType,
                bootstrapClass, bootstrapTheme, bootstrapSpacing;

            if (self.settings.bootstrap) {
                bootstrapClass = TableExport.prototype.bootstrap[0] + " ";
                bootstrapTheme = TableExport.prototype.bootstrap[1] + " ";
                bootstrapSpacing = TableExport.prototype.bootstrap[2] + " ";
            } else {
                bootstrapClass = TableExport.prototype.defaultButton + " ";
                bootstrapTheme = bootstrapSpacing = "";
            }

            self.selectors.forEach(function (el) {
                var caption = el.querySelectorAll('caption:not(.head)');
                isUpdate && caption.parentNode.removeChild(caption);

                var rows = _nodesArray(el.querySelectorAll('tbody > tr')),
                    rows = self.settings.headings ? _nodesArray(el.querySelectorAll("thead > tr")).concat(rows) : rows,
                    rows = self.settings.footers ? _nodesArray(el.querySelectorAll("tfoot > tr")).concat(rows) : rows,
                    thAdj = self.settings.headings ? el.querySelectorAll('thead > tr').length : 0,
                    filename = self.settings.filename === "id" ? (el.getAttribute('id') ? el.getAttribute('id') : TableExport.prototype.defaultFilename) : self.settings.filename,
                    exporters = {
                        xlsx: function (rDel, name) {
                            var rcMap = {},
                                dataURL = _nodesArray(rows).map(function (val, ir) {
                                    if (!!~ignoreRows.indexOf(ir - thAdj) || _hasClass(val, ignoreCSS)) {
                                        return;
                                    }
                                    var cols = val.querySelectorAll('th, td');
                                    return _nodesArray(cols).map(function (val, ic) {
                                        if (!!~ignoreCols.indexOf(ic) || _hasClass(val, ignoreCSS)) {
                                            return;
                                        }
                                        if (_hasClass(val, emptyCSS)) {
                                            return " "
                                        }
                                        if (val.hasAttribute('colspan')) {
                                            rcMap[ir] = rcMap[ir] || {};
                                            rcMap[ir][ic + 1] = val.getAttribute('colspan') - 1
                                        }
                                        if (val.hasAttribute('rowspan')) {
                                            for (var i = 1; i < val.getAttribute('rowspan'); i++) {
                                                rcMap[ir + i] = rcMap[ir + i] || {};
                                                rcMap[ir + i][ic] = 1
                                            }
                                        }
                                        if (rcMap[ir]) {
                                            var threshold = ic + 1,
                                                total = 0,
                                                count = 0;

                                            for (var i = 0; i <= Math.max.apply(Math, Object.keys(rcMap[ir])); i++) {
                                                (!rcMap[ir][i]) ? count++ : total = count >= ic ? total + rcMap[ir][i] : total;
                                                if (count === threshold) {
                                                    break;
                                                }
                                            }
                                            return new Array(total).concat({
                                                v: formatValue(val.textContent),
                                                t: getType(val.className)
                                            });
                                        }
                                        return {
                                            v: formatValue(val.textContent),
                                            t: getType(val.className)
                                        };
                                    });
                                }),
                                dataObject = TableExport.prototype.escapeHtml(
                                    JSON.stringify({
                                        data: dataURL,
                                        filename: name,
                                        mimeType: TableExport.prototype.xlsx.mimeType,
                                        fileExtension: TableExport.prototype.xlsx.fileExtension
                                    })),
                                myContent = TableExport.prototype.xlsx.buttonContent,
                                myClass = TableExport.prototype.xlsx.defaultClass;
                            createObjButton(dataObject, myContent, myClass);
                        },
                        xlsm: function (rDel, name) {
                            var rcMap = {},
                                dataURL = _nodesArray(rows).map(function (val, ir) {
                                    if (!!~ignoreRows.indexOf(ir - thAdj) || _hasClass(val, ignoreCSS)) {
                                        return;
                                    }
                                    var cols = val.querySelectorAll('th, td');
                                    return _nodesArray(cols).map(function (val, ic) {
                                        if (!!~ignoreCols.indexOf(ic) || _hasClass(val, ignoreCSS)) {
                                            return;
                                        }
                                        if (_hasClass(val, emptyCSS)) {
                                            return " "
                                        }
                                        if (val.hasAttribute('colspan')) {
                                            rcMap[ir] = rcMap[ir] || {};
                                            rcMap[ir][ic + 1] = val.getAttribute('colspan') - 1
                                        }
                                        if (val.hasAttribute('rowspan')) {
                                            for (var i = 1; i < val.getAttribute('rowspan'); i++) {
                                                rcMap[ir + i] = rcMap[ir + i] || {};
                                                rcMap[ir + i][ic] = 1
                                            }
                                        }
                                        if (rcMap[ir]) {
                                            var threshold = ic + 1,
                                                total = 0,
                                                count = 0;

                                            for (var i = 0; i <= Math.max.apply(Math, Object.keys(rcMap[ir])); i++) {
                                                (!rcMap[ir][i]) ? count++ : total = count >= ic ? total + rcMap[ir][i] : total;
                                                if (count === threshold) {
                                                    break;
                                                }
                                            }
                                            return new Array(total).concat({
                                                v: formatValue(val.textContent),
                                                t: getType(val.className)
                                            });
                                        }
                                        return {
                                            v: formatValue(val.textContent),
                                            t: getType(val.className)
                                        };
                                    });
                                }),
                                dataObject = TableExport.prototype.escapeHtml(
                                    JSON.stringify({
                                        data: dataURL,
                                        filename: name,
                                        mimeType: TableExport.prototype.xls.mimeType,
                                        fileExtension: TableExport.prototype.xls.fileExtension
                                    })),
                                myContent = TableExport.prototype.xls.buttonContent,
                                myClass = TableExport.prototype.xls.defaultClass;
                            createObjButton(dataObject, myContent, myClass);
                        },
                        xls: function (rdel, name) {
                            var colD = TableExport.prototype.xls.separator,
                                dataURL = _nodesArray(rows).map(function (val, i) {
                                    if (!!~ignoreRows.indexOf(i - thAdj) || _hasClass(val, ignoreCSS)) {
                                        return;
                                    }
                                    var cols = val.querySelectorAll('th, td');
                                    return _nodesArray(cols).map(function (val, i) {
                                        if (!!~ignoreCols.indexOf(i) || _hasClass(val, ignoreCSS)) {
                                            return;
                                        }
                                        if (_hasClass(val, emptyCSS)) {
                                            return " "
                                        }
                                        return {
                                            v: formatValue(val.textContent),
                                            t: getType(val.className)
                                        };
                                    }).join(colD);
                                }).join(rdel),
                                dataObject = TableExport.prototype.escapeHtml(
                                    JSON.stringify({
                                        data: dataURL,
                                        filename: name,
                                        mimeType: TableExport.prototype.xls.mimeType,
{'fraction_non_alphanumeric': 0.092496499464624, 'fraction_numerical': 0.0023062350712461906, 'mean_word_length': 0.8105427974947808, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 17, 'https://': 2, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 331, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7031530', 'n_tokens_mistral': 4724, 'n_tokens_neox': 4545, 'n_words': 941}