
Research
/Security News
Fake imToken Chrome Extension Steals Seed Phrases via Phishing Redirects
Mixed-script homoglyphs and a lookalike domain mimic imToken’s import flow to capture mnemonics and private keys.
Make strings url-safe.
window.slugg) and AMD/CommonJS-flavoured module loadersnpm install slugg
var slug = require('slugg')
slug('My fantastic blog post')
//-> 'my-fantastic-blog-post'
slug('Today I found £5')
//-> 'today-i-found-5'
slug('I ♥ you')
//-> 'i-you'
If you want a separator other than '-', pass it in as the second argument:
slug('Kevin Spacey', ' ')
//-> 'kevin spacey'
By default, slugg will strip (i.e. remove and not replace) any sort of quotemark: '"’‘”“.
If you want to control which characters are stripped, pass a regex as the last option that will match the chars you want to replace, eg:
slug('Mum\'s cooking', /'/g)
//-> 'mums-cooking'
Remember to use the g flag if you want all the matches stripped (not just the first).
After version 1.1.0, a new syntax has been introduced:
If you want a separator other than '-', pass it in as the separator option:
slug('Kevin Spacey', { separator: ' ' })
//-> 'kevin spacey'
If you want to control which characters are stripped, pass a regex as the toStrip option
that will match the chars you want to replace, eg:
slug('Mum\'s cooking', { toStrip: /'/g })
//-> 'mums-cooking'
Remember to use the g flag if you want all the matches stripped (not just the first).
By default, slugg will convert your string to lower case. If you want to disable it just
pass the toLowerCase option as false, eg:
slug('Slugg rocks!', { toLowerCase: false })
//-> 'Slugg-rocks'
FAQs
Make strings url safe (with no dependencies)
The npm package slugg receives a total of 33,563 weekly downloads. As such, slugg popularity was classified as popular.
We found that slugg demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Research
/Security News
Mixed-script homoglyphs and a lookalike domain mimic imToken’s import flow to capture mnemonics and private keys.

Security News
Latio’s 2026 report recognizes Socket as a Supply Chain Innovator and highlights our work in 0-day malware detection, SCA, and auto-patching.

Company News
Join Socket for live demos, rooftop happy hours, and one-on-one meetings during BSidesSF and RSA 2026 in San Francisco.