1.0.1 • Published 3 months ago
convert2slug v1.0.1
Convert2Slug
Convert2Slug is a lightweight npm package that enables you to create URL-friendly slugs from string content effortlessly. It takes a string input and converts it into a slug format suitable for URLs.
Installation
You can install Convert2Slug via npm:
npm install convert2slug
Usage
import createSlug from "convert2slug";
const originalString = 'Place To show Google AdSense';
const slug = createSlug(originalString);
console.log(slug); // Output: place-to-show-google-adsense
Features
- Generates URL-friendly slugs from string content
- Handles special characters and non-ASCII characters intelligently
- Easy to integrate into your projects with ES6 import syntax
API
createSlug(inputString)
- inputString: The original string that you want to convert into a slug.
Returns: A slugified version of the input string.
Examples
import createSlug from "convert2slug";
console.log(createSlug('Hello World')); // Output: hello-world
console.log(createSlug('This is a Test')); // Output: this-is-a-test
console.log(createSlug('Special Characters: !@#$%^&*()')); // Output: special-characters