<commit_before>/**
 * If given to parse, this callback will be invoked per each found emoji.
 *
 * If this callback returns a falsy value instead of a valid `src` to use for the image, nothing will actually change for that specific emoji.
 *
 * @param icon the lower case HEX code point i.e. "1f4a9"
 * @param options all info for this parsing operation
 * @param variant the optional \uFE0F ("as image") variant, in case this info is anyhow meaningful. By default this is ignored.
 */
type ParseCallback = (icon: string, options: object, variant: string) => string | false;

type Replacer = (substring: string, ...args: any[]) => string;

interface TwemojiOptions {
  /**
   * Default: MaxCDN
   */
  base?: string;
  /**
   * Default: .png
   */
  ext?: string;
  /**
   * Default: emoji
   */
  className?: string;
  /**
   * Default: 72x72
   */
  size?: string | number;
  /**
   * To render with SVG use `folder: svg, ext: .svg`
   */
  folder?: string;
  /**
   * The function to invoke in order to generate image src(s).
   */
  callback?: ParseCallback
  /**
   * The function to invoke in order to generate additional, custom attributes for the image tag.
   * Default () => ({})
   * @param icon the lower case HEX code point i.e. "1f4a9"
   * @param variant variant the optional \uFE0F ("as image") variant, in case this info is anyhow meaningful. By default this is ignored.
   * 
   */
  attributes?(icon: string, variant: string): object;
}

type Twemoji = {
  base: string;
  ext: string;
  className: string;
  size: string;
  convert: {
    /**
     * Given an HEX codepoint, returns UTF16 surrogate pairs.
     *
     * @param   codepoint string  generic codepoint, i.e. '1F4A9'
     * @return  string  codepoint transformed into utf16 surrogates pair,
     *          i.e. \uD83D\uDCA9
     *
     * @example
     *  twemoji.convert.fromCodePoint('1f1e8');
     *  // "\ud83c\udde8"
     *
     *  '1f1e8-1f1f3'.split('-').map(twemoji.convert.fromCodePoint).join('')
     *  // "\ud83c\udde8\ud83c\uddf3"
     */
    fromCodePoint(hexCodePoint: string): string;

    /**
     * Given UTF16 surrogate pairs, returns the equivalent HEX codepoint.
     *
     * @param   utf16surrogatePairs   string  generic utf16 surrogates pair, i.e. \uD83D\uDCA9
     * @param   sep                 string  optional separator for double code points, default='-'
     * @return  string  utf16 transformed into codepoint, i.e. '1F4A9'
     *
     * @example
     *  twemoji.convert.toCodePoint('\ud83c\udde8\ud83c\uddf3');
     *  // "1f1e8-1f1f3"
     *
     *  twemoji.convert.toCodePoint('\ud83c\udde8\ud83c\uddf3', '~');
     *  // "1f1e8~1f1f3"
     */
    toCodePoint(utf16surrogatePairs: string, sep?: string): string;
  };
  parse<T extends string | HTMLElement>(node: T, options?: TwemojiOptions | ParseCallback): T;
  replace(text: string, replacer: string | Replacer): string;
  test(text: string): boolean;
  onerror(): void;
};

declare module 'twemoji' {
  const twemoji: Twemoji;
  export default twemoji;
}<commit_msg>cleanup types<commit_after>/**
 * If given to parse, this callback will be invoked per each found emoji.
 *
 * If this callback returns a falsy value instead of a valid `src` to use for the image, nothing will actually change for that specific emoji.
 *
 * @param icon the lower case HEX code point i.e. "1f4a9"
 * @param options all info for this parsing operation
 * @param variant the optional \uFE0F ("as image") variant, in case this info is anyhow meaningful. By default this is ignored.
 */
type ParseCallback = (icon: string, options: object, variant: string) => string | false;

type ReplacerFunction = (substring: string, ...args: any[]) => string;

type Replacer = string | ReplacerFunction;

interface TwemojiOptions {
  /**
   * Default: MaxCDN
   */
  base?: string;
  /**
   * Default: .png
   */
  ext?: string;
  /**
   * Default: emoji
   */
  className?: string;
  /**
   * Default: 72x72
   */
  size?: string | number;
  /**
   * To render with SVG use `folder: svg, ext: .svg`
   */
  folder?: string;
  /**
   * The function to invoke in order to generate image src(s).
   */
  callback?: ParseCallback
  /**
   * The function to invoke in order to generate additional, custom attributes for the image tag.
   * Default () => ({})
   * @param icon the lower case HEX code point i.e. "1f4a9"
   * @param variant variant the optional \uFE0F ("as image") variant, in case this info is anyhow meaningful. By default this is ignored.
   * 
   */
  attributes?(icon: string, variant: string): object;
}

type Twemoji = {
  base: string;
  ext: string;
  className: string;
  size: string;
  convert: {
    /**
     * Given an HEX codepoint, returns UTF16 surrogate pairs.
     *
     * @param   codepoint string  generic codepoint, i.e. '1F4A9'
     * @return  string  codepoint transformed into utf16 surrogates pair,
     *          i.e. \uD83D\uDCA9
     *
     * @example
     *  twemoji.convert.fromCodePoint('1f1e8');
     *  // "\ud83c\udde8"
     *
     *  '1f1e8-1f1f3'.split('-').map(twemoji.convert.fromCodePoint).join('')
     *  // "\ud83c\udde8\ud83c\uddf3"
     */
    fromCodePoint(hexCodePoint: string): string;

    /**
     * Given UTF16 surrogate pairs, returns the equivalent HEX codepoint.
     *
     * @param   utf16surrogatePairs   string  generic utf16 surrogates pair, i.e. \uD83D\uDCA9
     * @param   sep                 string  optional separator for double code points, default='-'
     * @return  string  utf16 transformed into codepoint, i.e. '1F4A9'
     *
     * @example
     *  twemoji.convert.toCodePoint('\ud83c\udde8\ud83c\uddf3');
     *  // "1f1e8-1f1f3"
     *
     *  twemoji.convert.toCodePoint('\ud83c\udde8\ud83c\uddf3', '~');
     *  // "1f1e8~1f1f3"
     */
    toCodePoint(utf16surrogatePairs: string, sep?: string): string;
  };
  parse<T extends string | HTMLElement>(node: T, options?: TwemojiOptions | ParseCallback): T;
  replace(text: string, replacer: Replacer): string;
  test(text: string): boolean;
  onerror(): void;
};

declare module 'twemoji' {
  const twemoji: Twemoji;
  export default twemoji;
}
{'fraction_non_alphanumeric': 0.12624693376941945, 'fraction_numerical': 0.02616516762060507, 'mean_word_length': 2.820112429731418, 'pattern_counts': {'":': 0, '<': 5, '<?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': '1811376', 'n_tokens_mistral': 2115, 'n_tokens_neox': 2073, 'n_words': 618}