A simple utility to convert strings into slugs. Note: WORK IN PROGRESS - used mainly now to test to upload a package to jsr.io
--> https://jsr.io/@geeron/sluggo
The sluggo
function converts a string into a slug. You can customize the separator and whether the output should be uppercase.
import { sluggo } from '@geeron/sluggo' sluggo('Hello World') // hello-world sluggo('Hello World', { separator: '_' }) // hello_world sluggo('Hello World', { uppercase: true }) // HELLO-WORLD
sluggo(string: string, options?: SlugOptions): string
Converts a string into a slug.
string
(string): The input string to convert.options
(SlugOptions, optional): An optional object to customize the output.
separator
(string, optional): The separator to use between words. Defaults to '-'
.uppercase
(boolean, optional): Whether to convert the output to uppercase. Defaults to false
.string
: The converted slug.To run the tests, use the following command:
deno test
We welcome contributions from the community! If you would like to contribute, please follow these steps:
This project is licensed under the MIT License.
Add Package
deno add jsr:@geeron/sluggo
Import symbol
import * as sluggo from "@geeron/sluggo";
---- OR ----
Import directly with a jsr specifier
import * as sluggo from "jsr:@geeron/sluggo";
Add Package
npx jsr add @geeron/sluggo
Import symbol
import * as sluggo from "@geeron/sluggo";
Add Package
yarn dlx jsr add @geeron/sluggo
Import symbol
import * as sluggo from "@geeron/sluggo";
Add Package
pnpm dlx jsr add @geeron/sluggo
Import symbol
import * as sluggo from "@geeron/sluggo";
Add Package
bunx jsr add @geeron/sluggo
Import symbol
import * as sluggo from "@geeron/sluggo";