import { slug } from "https://deno.land/x/slug@v1.1.0/mod.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
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
slug("some ƒÚÑķÝ and ☢ string", { replacement: "-", remove: undefined, lower: true, strict: false, locale: "vi", trim: true, extends: { "☢": "nuclear" }, }); // some-fUNkY-and-nuclear-string
Parameters
optional
options: string | Partial<SlugOptions>