toSnakeCase = (inputStr) => {
  return inputStr
    .replace(/\W+/g, ' ')
    .split(/ |\B(?=[A-Z])/)
    .map((word) => word.toLowerCase())
    .join('_');
}
Convert a camelCase or PascalCase string to snake_case.
If the string is already in snake_case, it will be returned unchanged.

@param {string} camelStr - The string to convert to snake_case
@returns {string} The converted snake_case string