<commit_before>import { Meteor } from 'meteor/meteor';
import { Session } from 'meteor/session';
import { timers } from '/lib/const';
import { slug } from 'slug';

// global variables
let contractId = 0;

//Global Methods
//Returns current app language
getUserLanguage = function () {
  // Put here the logic for determining the user language
  return $LANGUAGE;
};


/**
* @summary if _here
* @param {object} post data
* @param {array} feed list
* @return {boolean} 🙏
*/
export const here = (post, feed) => {
  for (const items in feed) {
    if (feed[items]._id === post._id) {
      return true;
    }
  }
  return false;
};


// Decides if it should hide or not a DOM element
export const displayElement = function (sessionVar) {
  if (Session.get(sessionVar)) {
    return '';
  } else {
    return 'display:none';
  }
};

// Displays a warning for a limited period.
export const displayTimedWarning = (warning, val) => {
  if (!val) {
    val = false;
  }
  if (Session.get(warning)) {
    Meteor.setTimeout(() => {
      Session.set(warning, val);
    }, timers.WARNING_DURATION);
  }
  return Session.get(warning);
};

// Contract constructor.
contract = function (title, description, tags) {
  this.title = title;
  this.description = description;
  this.tags = tags;
};

// Return an ASCII-friendly, URL-friendly, safer slug-cased text.
export const convertToSlug = function (text) {
  if (text === undefined) return undefined; // Contract's `Object.autoValue` may try to convert `undefined`.
  return slug(text, { lower: true });
};

// Return an somewhat email-friendly (among other things), safer username.
export const convertToUsername = (unsafeUsername) => {
  return convertToSlug(unsafeUsername).replace(/-+/, '');
};

//given a user profile it returns a slugged version of her name
// slugName = function (profile) {
//   var name = new String();
//   if (profile != undefined) {
//     if (profile.firstName != undefined) {
//       name = convertToSlug(profile.firstName);
//     }
//     if (profile.lastName != undefined) {
//       name += '-' + convertToSlug(profile.lastName);
//     }<commit_msg>witchcraft<commit_after>import { Meteor } from 'meteor/meteor';
import { Session } from 'meteor/session';
import { timers } from '/lib/const';
import slug from 'slug';

// global variables
let contractId = 0;

//Global Methods
//Returns current app language
getUserLanguage = function () {
  // Put here the logic for determining the user language
  return $LANGUAGE;
};


/**
* @summary if _here
* @param {object} post data
* @param {array} feed list
* @return {boolean} 🙏
*/
export const here = (post, feed) => {
  for (const items in feed) {
    if (feed[items]._id === post._id) {
      return true;
    }
  }
  return false;
};


// Decides if it should hide or not a DOM element
export const displayElement = function (sessionVar) {
  if (Session.get(sessionVar)) {
    return '';
  } else {
    return 'display:none';
  }
};

// Displays a warning for a limited period.
export const displayTimedWarning = (warning, val) => {
  if (!val) {
    val = false;
  }
  if (Session.get(warning)) {
    Meteor.setTimeout(() => {
      Session.set(warning, val);
    }, timers.WARNING_DURATION);
  }
  return Session.get(warning);
};

// Contract constructor.
contract = function (title, description, tags) {
  this.title = title;
  this.description = description;
  this.tags = tags;
};

// Return an ASCII-friendly, URL-friendly, safer slug-cased text.
export const convertToSlug = function (text) {
  if (text === undefined) return undefined; // Contract's `Object.autoValue` may try to convert `undefined`.
  return slug(text, {lower: true});
};

// Return an somewhat email-friendly (among other things), safer username.
export const convertToUsername = (unsafeUsername) => {
  return convertToSlug(unsafeUsername).replace(/-+/, '');
};

//given a user profile it returns a slugged version of her name
// slugName = function (profile) {
//   var name = new String();
//   if (profile != undefined) {
//     if (profile.firstName != undefined) {
//       name = convertToSlug(profile.firstName);
//     }
//     if (profile.lastName != undefined) {
//       name += '-' + convertToSlug(profile.lastName);
//     }
{'fraction_non_alphanumeric': 0.14491385414208166, 'fraction_numerical': 0.0004720320981826764, 'mean_word_length': 3.2764883955600403, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 11, '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': '5121738', 'n_tokens_mistral': 1329, 'n_tokens_neox': 1287, 'n_words': 408}