@kzttools/auto-slugify
v0.0.11
Published
this is a pkg which make the slugify easier
Downloads
39
Readme
@kzttools/auto-slugify
demo
demo's site:
demo's source code:
https://github.com/KazooTTT/auto-slugify-webapp
方法: getSlugResult
描述: 这个函数用于生成字符串的 slug。
输入参数:
| 参数名 | 类型 | 描述 | | --- | --- | --- | | str | 字符串 | 要生成 slug 的字符串。 |
返回值:
| 类型 | 描述 | | --- | --- | | 字符串 | 生成的 slug。 |
示例用法:
esm
import getSlugResult from "@kzttools/auto-slugify";
...
const slug = await getSlugResult("Hello, World!");
console.log(slug); // 输出: hello-world
import getSlugResult from "@kzttools/auto-slugify";
...
const slug = await getSlugResult("自动生成slug");
console.log(slug); // 输出: automatically-generate-slugs
mjs
const getSlugResult = require("@kzttools/auto-slugify")
...
const slug = await getSlugResult("自动生成slug");
console.log(slug); // 输出: automatically-generate-slugs
注意: 如果输入的字符串包含中文,函数会先将其翻译为英文,然后再生成 slug。