<commit_before>/*
* zero width
* author: ronglin
* create date: 2014.6.18
* reference:
*    http://ucren.com/blog/archives/549
*/

'use strict';

var bit = 12, marker = '\ufeff';

var spaces = ['\u200b', '\u200c', '\u200d'], slen = spaces.length;

var zeroWidth = {
    //
    hide: function (str) {
        var prefix = [];
        for (var m = 0; m < bit; m++) {
            prefix.push(marker);
        }
        var codeSet = [prefix.join('')];
        for (var i = 0, code, len = str.length; i < len; i++) {
            code = str.charCodeAt(i).toString(slen);
            if (code.length > bit) {
                return (bit = code.length, this.hide(str));
            }
            while (code.length < bit) {
                code = '0' + code;
            }
            for (var s = 0; s < slen; s++) {
                code = code.replace(new RegExp(s + '', 'g'), spaces[s]);
            }
            codeSet.push(code);
        }
        return codeSet.join('');
    },
    //
    show: function (str) {
        var count = 0;
        while (str.charAt(count) === marker) {
            count++;
        }
        return str.substr(count).replace(new RegExp('.{' + (count || bit) + '}', 'g'), function (code) {
            for (var i = 0; i < slen; i++) {
                code = code.replace(new RegExp(spaces[i], 'g'), i + '');
            }
            return String.fromCharCode(parseInt(code, slen));
        });
    }
};

if (typeof(window) !== 'undefined') {
	window.zeroWidth = zeroWidth;
}
if (typeof(module) !== 'undefined') {
	module.exports = zeroWidth;
}<commit_msg>format<commit_after>/*
* zero width
* author: ronglin
* create date: 2014.6.18
* reference:
*    http://ucren.com/blog/archives/549
*/

'use strict';

var bit = 12, marker = '\ufeff';

var spaces = ['\u200b', '\u200c', '\u200d'], slen = spaces.length;

var zeroWidth = {
    //
    hide: function (str) {
        var prefix = [];
        for (var m = 0; m < bit; m++) {
            prefix.push(marker);
        }
        var codeSet = [prefix.join('')];
        for (var i = 0, code, len = str.length; i < len; i++) {
            code = str.charCodeAt(i).toString(slen);
            if (code.length > bit) {
                return (bit = code.length, this.hide(str));
            }
            while (code.length < bit) {
                code = '0' + code;
            }
            for (var s = 0; s < slen; s++) {
                code = code.replace(new RegExp(s + '', 'g'), spaces[s]);
            }
            codeSet.push(code);
        }
        return codeSet.join('');
    },
    //
    show: function (str) {
        var count = 0;
        while (str.charAt(count) === marker) {
            count++;
        }
        return str.substr(count).replace(new RegExp('.{' + (count || bit) + '}', 'g'), function (code) {
            for (var i = 0; i < slen; i++) {
                code = code.replace(new RegExp(spaces[i], 'g'), i + '');
            }
            return String.fromCharCode(parseInt(code, slen));
        });
    }
};

if (typeof (window) !== 'undefined') {
    window.zeroWidth = zeroWidth;
}
if (typeof (module) !== 'undefined') {
    module.exports = zeroWidth;
}
{'fraction_non_alphanumeric': 0.18141732283464568, 'fraction_numerical': 0.01700787401574803, 'mean_word_length': 1.689246401354784, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 5, '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': '4464331', 'n_tokens_mistral': 1079, 'n_tokens_neox': 1033, 'n_words': 252}