generateSlugName(str) {
    if (typeof str !== 'string')
      throw new InvalidSlugStringError({
        message: 'Source string is undefined or not a string.'
      });

    str = str.trim();

    if (str === '')
      throw new InvalidSlugStringError({
        message: 'Source string cannot be empty.'
      });

    let slugName = unescapeHTML(str)
      .trim()
      .toLowerCase()
      .replace(/[?&"″'`’<>:]/g, '')
      .replace(/[ _/]/g, '-')
      .replace(/-{2,}/g, '-'); // Avoid consecutive hyphens

    if (!slugName)
      throw new InvalidSlugStringError({
        message: 'Source string %s cannot be converted to a valid slug.',
        messageParams: [str]
      }); // Expected depending on user input

    if (isUUID.v4(slugName))
      throw new InvalidSlugStringError({
        message: 'Source string cannot be a UUID.'
      });

    return slugName;
  }
// or throws an error if this is not possible. String must be monolingual.
or throws an error if this is not possible. String must be monolingual.
or throws an error if this is not possible . String must be monolingual .
generateSlugName(str) {
    if (typeof str !== 'string')
      throw new InvalidSlugStringError({
        message: 'Source string is undefined or not a string.'
      });
    str = str.trim();
    if (str === '')
      throw new InvalidSlugStringError({
        message: 'Source string cannot be empty.'
      });
    let slugName = unescapeHTML(str)
      .trim()
      .toLowerCase()
      .replace(/[?&"″'`’<>:]/g, '')
      .replace(/[ _/]/g, '-')
      .replace(/-{2,}/g, '-'); 
    if (!slugName)
      throw new InvalidSlugStringError({
        message: 'Source string %s cannot be converted to a valid slug.',
        messageParams: [str]
      }); 
    if (isUUID.v4(slugName))
      throw new InvalidSlugStringError({
        message: 'Source string cannot be a UUID.'
      });
    return slugName;
  }
generateSlugName ( str ) { if ( typeof str !== 'string' ) throw new InvalidSlugStringError ( { message : 'Source string is undefined or not a string.' } ) ; str = str . trim ( ) ; if ( str === '' ) throw new InvalidSlugStringError ( { message : 'Source string cannot be empty.' } ) ; let slugName = unescapeHTML ( str ) . trim ( ) . toLowerCase ( ) . replace ( / [?&"″'`’<>:]/g,  ' ' ) . replace ( / [ _/] / g , '-' ) . replace ( / -{2,} / g , '-' ) ; if ( ! slugName ) throw new InvalidSlugStringError ( { message : 'Source string %s cannot be converted to a valid slug.' , messageParams : [ str ] } ) ; if ( isUUID . v4 ( slugName ) ) throw new InvalidSlugStringError ( { message : 'Source string cannot be a UUID.' } ) ; return slugName ; }
or throws an error if this is not possible.
or throws an error if this is not possible .
// Avoid consecutive hyphens // Expected depending on user input