Skip to content

Commit

Permalink
-
Browse files Browse the repository at this point in the history
  • Loading branch information
timonson committed Dec 8, 2023
1 parent 72f0e29 commit 6acc3c9
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions strings/mapping.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,3 +78,13 @@ export function convertDashesToSpaces(str) {
(match, group) => ` ${group}`,
);
}

/**
* Takes a string and converts spaces to dashes.
*
* @param {string} str
* @return {string}
*/
export function convertSpacesToDashes(str) {
return str.replace(/\s+/g, "-");
}

0 comments on commit 6acc3c9

Please sign in to comment.