Note: The makeFileName() function may not be sufficient for all desired file name outputs.
In the file name output, sections of white-space are replaced with a single dash and symbols are removed.
It works for string inputs as shown in the following examples.
makeFileName('How To Tie A Shoelace The 2023 Way');
/* returns 'how-to-tie-a-shoelace-the-2023-way' */
makeFileName('usbcush 67 xhgx% ()#');
/* returns 'usbcush-67-xhgx' */
- Open the index.html file of this make-cli-file-name directory in a web browser.
- Call the makeFileName function with your non-CLI-friendly file name string passed as its argument in your browser console.
- Copy the returned string and paste it as your CLI friendly file name.