The following options exist:
{
removeTrailingSpaces: true,
remove: /[^0-9A-Za-z\-\+\_]+/g,
replacement: '-',
lower: true
}
const slug = require('hive-slug');
slug(' Hello World '); // output: hello-world
slug(' Hello World ', { replacement: '_ '}); // output: hello_world
You can pass in any string of your choice. Trailing hyphens and underscores will be removed.
If you don't want trailing spaces to be removed, you can pass removeTrailingSpaces: false
in the options object
By default, all characters that are not alphanumeric, underscores and hyphens