Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/ter/deps/slug.ts>slug

A tiny wiki-style site generator with Zettelkasten flavor.
Latest
function slug
import { slug } from "https://deno.land/x/ter@0.15.57/deps/slug.ts";

Converts a string into a valid slug

Examples

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: true }); // i-love-unicode

slug("some ƒÚÑķÝ and ☢ string", { replacement: "-", remove: undefined, lower: true, strict: false, locale: "vi", trim: true, extends: { "☢": "nuclear" }, }); // some-fUNkY-and-nuclear-string

Parameters

input: string
optional
options: string | Partial<SlugOptions>

Returns

string