@taishikato/slug-generator
TypeScript icon, indicating that this package has built-in type declarations

2.2.0 • Public • Published

@taishikato/slug-generator

npm (scoped) npm bundle size (scoped)

Install

With npm

$ npm i @taishikato/slug-generator

With yarn

$ yarn add @taishikato/slug-generator

Usage

import generateSlug from '@taishikato/slug-generator';

generateSlug('My first blog post title (March 21)');
// → my-first-blog-post-title-march-21

/**
 * When you pass true as a second argument, the slug will have a random strings at the end
 * This is useful when some items(i.e. blog posts) can have the same title, which means those will have the same slug
 * and you want a unique slug for each item.
 */
generateSlug('My first blog post title (March 21)', true);
// → my-first-blog-post-title-march-21-1cc703f7

/@taishikato/slug-generator/

    Package Sidebar

    Install

    npm i @taishikato/slug-generator

    Weekly Downloads

    1

    Version

    2.2.0

    License

    MIT

    Unpacked Size

    9.06 kB

    Total Files

    6

    Last publish

    Collaborators

    • taishikato