gitfoss-fork | a2f58b50019904ecb5048350d3f2d94d697905ea | app/utils/shared/removeCommentsAndSpacing.ts ∙ GitFOSS
.ts
TypeScript
(application/typescript)
/**
 * Removes comments and extra spacing from a string.
 *
 * @param str The string to process.
 * @returns The processed string.
 */
export default function removeCommentsAndSpacing(str = "") {
  return str.replace(/\/\*.*\*\//g, " ").replace(/\s+/g, " ");
}