<commit_before>import Ember from 'ember';
import urlRegex from 'ember-linkify/utils/url-regex';

export function linkify(textToLinkify, windowTarget) {
  windowTarget = windowTarget || "_self";
  textToLinkify = Ember.Handlebars.Utils.escapeExpression(textToLinkify);

  textToLinkify = textToLinkify.replace(urlRegex(), function (s) {
    var url;
    if(s.trim().match(/^www\./ig)) {
      url = '//' + s.trim();
    } else {
      url = s.trim();
    }
    return ' <a href="' + url + '" target="'+windowTarget+'">' + s.trim() + '</a> ';
  });

  return new Ember.Handlebars.SafeString(textToLinkify);
}

export default Ember.Helper.helper(linkify);<commit_msg>Use Ember.String.htmlsafe<commit_after>import Ember from 'ember';
import urlRegex from 'ember-linkify/utils/url-regex';

export function linkify(textToLinkify, windowTarget) {
  windowTarget = windowTarget || "_self";
  textToLinkify = Ember.Handlebars.Utils.escapeExpression(textToLinkify);

  textToLinkify = textToLinkify.replace(urlRegex(), function (s) {
    var url;
    if(s.trim().match(/^www\./ig)) {
      url = '//' + s.trim();
    } else {
      url = s.trim();
    }
    return ' <a href="' + url + '" target="'+windowTarget+'">' + s.trim() + '</a> ';
  });

  return Ember.String.htmlSafe(textToLinkify);
}

export default Ember.Helper.helper(linkify);
{'fraction_non_alphanumeric': 0.17443609022556392, 'fraction_numerical': 0.0, 'mean_word_length': 3.911439114391144, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, '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': '3360460', 'n_tokens_mistral': 456, 'n_tokens_neox': 449, 'n_words': 83}