Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

speakingurl

Package Overview
Dependencies
Maintainers
1
Versions
79
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

speakingurl

Generate a slug – transliteration with a lot of options

  • 1.1.5
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1M
increased by6.81%
Maintainers
1
Weekly downloads
 
Created

What is speakingurl?

The 'speakingurl' npm package is used to generate slugs from strings. It is particularly useful for creating URL-friendly strings from titles or other text inputs. The package supports multiple languages and offers various customization options.

What are speakingurl's main functionalities?

Basic Slug Generation

This feature allows you to convert a string into a URL-friendly slug. Special characters are removed, and spaces are replaced with hyphens.

const getSlug = require('speakingurl');
const slug = getSlug('Hello World!');
console.log(slug); // Output: 'hello-world'

Custom Separator

You can customize the separator used in the slug. In this example, an underscore is used instead of the default hyphen.

const getSlug = require('speakingurl');
const slug = getSlug('Hello World!', { separator: '_' });
console.log(slug); // Output: 'hello_world'

Language Support

The package supports multiple languages, allowing you to generate slugs that are appropriate for different linguistic contexts.

const getSlug = require('speakingurl');
const slug = getSlug('你好,世界', { lang: 'zh' });
console.log(slug); // Output: 'ni-hao-shi-jie'

Custom Transliteration

You can define custom transliterations for specific characters, giving you more control over the slug generation process.

const getSlug = require('speakingurl');
const slug = getSlug('Hello World!', { custom: { 'H': 'h', 'W': 'w' } });
console.log(slug); // Output: 'hello-world'

Other packages similar to speakingurl

Keywords

FAQs

Package last updated on 18 Apr 2015

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