1.0.4 • Published 1 month ago

shopify-slugify v1.0.4

Weekly downloads
-
License
MIT
Repository
github
Last release
1 month ago

Shopify Slugify

npm version License: MIT

Overview

Shopify Slugify is a simple npm package that provides a function for creating slugs from strings. It replaces special characters, removes spaces, and converts text to a URL-friendly format.

Installation

npm install shopify-slugify

Usage in JavaScript/Node.js

Once the package is installed, you can use it in your JavaScript/Node.js code. Import the slugify function and call it with a string to generate a slug:

import { slugify } from "shopify-slugify";

const inputString = "This is a Sample String!";
const slug = slugify(inputString);
console.log(slug);
// Output: this-is-a-sample-string

The slugify function takes a string as an argument and returns a slugified version of the input string. It performs the following transformations:

  • Converts the string to lowercase.
  • Replaces spaces with hyphens.
  • Replaces special characters with their corresponding ASCII equivalents.
  • Removes non-word characters (except for º and +).
  • Replaces multiple hyphens with a single hyphen.
  • Trims hyphens from the start and end of the resulting string.
1.0.4

1 month ago

1.0.3

1 month ago

1.0.2

2 months ago

1.0.1

2 months ago

1.0.0

2 months ago