<commit_before>'use strict';

/*
 * Browserify transform that strips meta attributes out of the plotlyjs bundle
 *
 */

var through = require('through2');

var attributeNamesToRemove = ['description', 'overview'],
    regexStr = '';

// ref: http://www.regexr.com/3bj6p
attributeNamesToRemove.forEach(function(attr, i) {
    // one line string with or without trailing comma
    regexStr += attr + ': \'.*\'' + ',?' + '|';
    // array of strings with or without trailing comma
    regexStr += attr + ': \\[[\\s\\S]*?\\].*' + ',?';

    if(i !== attributeNamesToRemove.length-1) regexStr += '|';
});

var regex = new RegExp(regexStr, 'g');

module.exports = function() {
    return through(function(buf, enc, next) {
        this.push(
            buf.toString('utf-8')
               .replace(regex, '')
        );
        next();
    });
};<commit_msg>remove 'requireOpts' and 'otherOpts' in browserify transform<commit_after>'use strict';

/*
 * Browserify transform that strips meta attributes out of the plotlyjs bundle
 *
 */

var through = require('through2');

var attributeNamesToRemove = ['description', 'overview', 'requiredOpts', 'otherOpts'],
    regexStr = '';

// ref: http://www.regexr.com/3bj6p
attributeNamesToRemove.forEach(function(attr, i) {
    // one line string with or without trailing comma
    regexStr += attr + ': \'.*\'' + ',?' + '|';
    // array of strings with or without trailing comma
    regexStr += attr + ': \\[[\\s\\S]*?\\].*' + ',?';

    if(i !== attributeNamesToRemove.length-1) regexStr += '|';
});

var regex = new RegExp(regexStr, 'g');

module.exports = function() {
    return through(function(buf, enc, next) {
        this.push(
            buf.toString('utf-8')
               .replace(regex, '')
        );
        next();
    });
};
{'fraction_non_alphanumeric': 0.1827354260089686, 'fraction_numerical': 0.005605381165919282, 'mean_word_length': 2.8720173535791758, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '7554346', 'n_tokens_mistral': 560, 'n_tokens_neox': 543, 'n_words': 136}