mirror of
https://github.com/DOI-DO/j40-cejst-2.git
synced 2025-07-29 06:11:16 -07:00
15 lines
401 B
JavaScript
15 lines
401 B
JavaScript
// Helper functions that need to be shared between both the src codebase
|
|
// and the cypress tests
|
|
|
|
/**
|
|
* This function will take a string and hyphenize it.
|
|
* For example:
|
|
* Whitehouse.gov => whitehouse-gov
|
|
* Privacy Policy => privacy-policy
|
|
*
|
|
* @param {string} string
|
|
* @return {string}
|
|
*/
|
|
export const hyphenizeString = (string) => {
|
|
return string.split(/\.| /).join('-').toLowerCase();
|
|
};
|