@annervisser/slug@1.2.1Built and signed on GitHub ActionsBuilt and signed on GitHub Actions
Built and signed on GitHub Actions
Deno library for converting arbitrary strings into valid slugs
This package works with DenoIt is unknown whether this package works with Cloudflare Workers, Node.js, Bun, Browsers




JSR Score
100%
Published
a year ago (1.2.1)
slug
Deno library for converting arbitrary strings into valid slugs
import { slug } from "https://deno.land/x/slug/mod.ts"; console.log(slug("some string")); // some-string console.log(slug("some string", "_")); // some_string console.log(slug("I ♥ UNICODE")); // i-love-unicode console.log(slug("I ♥ UNICODE", { lower: false })); // I-love-UNICODE
Options
slug("some ƒÚÑķÝ and ☢ string", { replacement: "-", // replace spaces with replacement character (defaults to `-`) remove: /[^\w\s$*_+~.()'"!\-:@]+/g, // remove characters that match regex (defaults to `/[^\w\s$*_+~.()'"!\-:@]+/g`) lower: true, // convert to lower case (defaults to `true`) strict: false, // strip special characters except replacement (defaults to `false`) locale: "vi", // language code of the locale to use (defaults to `vi`) trim: true, // trim leading and trailing replacement chars (defaults to `true`) extends: { "☢": "nuclear" }, // extend default unicode character set (defaults to `{}`) }); // some-funky-and-nuclear-string
Propers
Fork of https://github.com/dunosaurs/slug for publishing to JSR
Built and signed on
GitHub Actions
Add Package
deno add jsr:@annervisser/slug
Import symbol
import * as slug from "@annervisser/slug";
Import directly with a jsr specifier
import * as slug from "jsr:@annervisser/slug";
Add Package
pnpm i jsr:@annervisser/slug
pnpm dlx jsr add @annervisser/slug
Import symbol
import * as slug from "@annervisser/slug";
Add Package
yarn add jsr:@annervisser/slug
yarn dlx jsr add @annervisser/slug
Import symbol
import * as slug from "@annervisser/slug";
Add Package
vlt install jsr:@annervisser/slug
Import symbol
import * as slug from "@annervisser/slug";
Add Package
npx jsr add @annervisser/slug
Import symbol
import * as slug from "@annervisser/slug";
Add Package
bunx jsr add @annervisser/slug
Import symbol
import * as slug from "@annervisser/slug";