<commit_before>var Handlebars = require('handlebars');
var moment = require('moment');
var encode = require('email-scramble').encode;

var parseText = function(text, pattern, replacement, lowercase) {
    text = Handlebars.escapeExpression(text || '');
    text = text.replace(pattern, replacement);
    text = !!lowercase ? text.toLowerCase() : text;
    return new Handlebars.SafeString(text);
};

var formatDate = function(date, format) {
    date = Handlebars.escapeExpression(date || '');
    date = moment(new Date((date))).format(format);
    return new Handlebars.SafeString(date);
};

module.exports = {
    nl2br: function(content) {
        return parseText(content, /\n/g, '<br>');
    },
    sanitizePhone: function(phone) {
        return parseText(phone, /[-\s]/g, '', true);
    },
    sanitizeURL: function(url) {
        return parseText(url, /http?s:\/\//g, '', true);<commit_msg>Always parse dates as UTC, ignoring timezones. Fixes #2.<commit_after>var Handlebars = require('handlebars');
var moment = require('moment');
var encode = require('email-scramble').encode;

var parseText = function(text, pattern, replacement, lowercase) {
    text = Handlebars.escapeExpression(text || '');
    text = text.replace(pattern, replacement);
    text = !!lowercase ? text.toLowerCase() : text;
    return new Handlebars.SafeString(text);
};

var formatDate = function(date, format) {
    date = Handlebars.escapeExpression(date || '');
    date = moment(date).format(format);
    return new Handlebars.SafeString(date);
};

module.exports = {
    nl2br: function(content) {
        return parseText(content, /\n/g, '<br>');
    },
    sanitizePhone: function(phone) {
        return parseText(phone, /[-\s]/g, '', true);
    },
    sanitizeURL: function(url) {
        return parseText(url, /http?s:\/\//g, '', true);
{'fraction_non_alphanumeric': 0.16621104428649536, 'fraction_numerical': 0.0016402405686167304, 'mean_word_length': 3.8412698412698414, 'pattern_counts': {'":': 0, '<': 5, '<?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': '3460665', 'n_tokens_mistral': 554, 'n_tokens_neox': 555, 'n_words': 122}