<commit_before>import slugify from 'shared/utils/slugify'
import shortid from 'shared/utils/shortid'

//genereates event ids

/* creates event id prefix that can be used to create readable event id
  that is url-safe in the format "evt-ncnca-2017-name"
  "shortSegmentName" is any short name to segment events further, usually it's a
  calendar short name or any other meaninful acronym
*/
const createEventIdPrefix = (eventDate, eventName, shortSegmentName) => (
  shortSegmentName
    ? `evt-${shortSegmentName}-${eventDate.year()}-${slugify(eventName)}`
    : `evt-${eventDate.year()}-${slugify(eventName)}`
)

const createShortEventId = () => shortid()

const createPrettyEventId = (eventDate, eventName, shortSegmentName, id) => {
  return createEventIdPrefix(eventDate, eventName, shortSegmentName) + `-${id}`
}



export {
  createEventIdPrefix,
  createPrettyEventId,
  createShortEventId
}<commit_msg>updating short id implementation to not include “-“ by default since it’s used as a separator in our ids, replacing it with “$” instead<commit_after>/*
generate id manually by hitting
https://runkit.io/restuta/rcn-shortid/branches/master
*/

import slugify from 'shared/utils/slugify'
import shortid from 'shortid'
//custom alphabet, since by default it includes "-" which we are using as a separator as well
shortid.characters('0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_$');

//genereates event ids

/* creates event id prefix that can be used to create readable event id
  that is url-safe in the format "evt-ncnca-2017-name"
  "shortSegmentName" is any short name to segment events further, usually it's a
  calendar short name or any other meaninful acronym
*/
const createEventIdPrefix = (eventDate, eventName, shortSegmentName) => (
  shortSegmentName
    ? `evt-${shortSegmentName}-${eventDate.year()}-${slugify(eventName)}`
    : `evt-${eventDate.year()}-${slugify(eventName)}`
)

const createShortEventId = () => shortid.generate()

const createPrettyEventId = (eventDate, eventName, shortSegmentName, id) => {
  return createEventIdPrefix(eventDate, eventName, shortSegmentName) + `-${id}`
}



export {
  createEventIdPrefix,
  createPrettyEventId,
  createShortEventId
}
{'fraction_non_alphanumeric': 0.10890194306371441, 'fraction_numerical': 0.008133755083596927, 'mean_word_length': 5.236619718309859, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 9, 'https://': 1, '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': '2116754', 'n_tokens_mistral': 708, 'n_tokens_neox': 687, 'n_words': 199}