A simple helper function that splits and then joins words back together.
yarn add hyphenate
import hyphenate from 'hyphenate';
hyphenate('hello, world!'); // "hello-world"
hyphenate('JSONDataItems'); // "JSON-Data-Items"
hyphenate('JSONDataItems', {lowerCase: true}); // "json-data-items"