function replace(string, replacement) {
return string.split('').reduce(function (result, ch) {
if (charMap[ch]) {
ch = charMap[ch]
}
// allowed
ch = ch.replace(/[^\w\s$*_+~.()'"!\-:@]/g, '')
result += ch
return result
}, '')
// trim leading/trailing spaces
.replace(/^\s+|\s+$/g, '')
// convert spaces
.replace(/[-\s]+/g, replacement || '-')
// remove trailing separator
.replace('#{replacement}$', '')
}n/a
extend = function (customMap) {
for (var key in customMap) {
charMap[key] = customMap[key]
}
}...
```js
slugify('unicode ♥ is ☢') // unicode-love-is
```
However you can extend the supported symbols, or override the existing ones with your own:
```js
slugify.extend({'☢': 'radioactive'})
slugify('unicode ♥ is ☢') // unicode-love-is-radioactive
```
Keep in mind that the `extend` method extends/overrides the default `charMap` for the entire process. In case you need a fresh instance
of the slugify's `charMap` object you have to clean up the module cache first:
```js
delete require.cache[require.resolve('slugify')]
...