Socket
Socket
Sign inDemoInstall

@kchungradio/slugify

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@kchungradio/slugify

Slugify a string


Version published
Weekly downloads
2
Maintainers
1
Weekly downloads
 
Created
Source

slugify Build Status

Slugify a string

Useful for URLs, filenames, and IDs.

Install

$ npm install @sindresorhus/slugify

Usage

const slugify = require('@sindresorhus/slugify');

slugify('I ♥ Dogs');
//=> 'i-love-dogs'

slugify('  Déjà Vu!  ');
//=> 'deja-vu'

slugify('fooBar 123 $#%');
//=> 'foo-bar-123'

slugify('BAR and baz', {separator: '_'});
//=> 'bar_and_baz'

slugify('I ♥ 🦄 & 🐶', {
  customReplacements: [
    ['🐶', 'dog']
  ]
});
//=> 'i-love-unicorn-and-dog'

API

slugify(input, [options])

input

Type: string

options

Type: Object

separator

Type: string
Default: -

customReplacements

Type: Array
Default: [ ['&', 'and'], ['🦄', 'unicorn'], ['♥', 'love'] ]

Specifying this only replaces the default if you set an item with the same key, like &.

  • slugify-cli - CLI for this module
  • filenamify - Convert a string to a valid safe filename

License

MIT © Sindre Sorhus

Keywords

FAQs

Package last updated on 18 Aug 2018

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc