@anthonypena/slugger
TypeScript icon, indicating that this package has built-in type declarations

1.0.0 • Public • Published

@anthonypena/slugger

Install

npm i @anthonypena/slugger

Examples

import { createBot, createBotSpace } from '@anthonypena/slugger'

const slugger = new Slugger();
slugger.slug('Short heading'); // short-heading
slugger.slug('A longer (sentence)[to slug]'); // a-longer-sentenceto-slug
slugger.slug('Handle double entry too'); // handle-double-entry-too
slugger.slug('Handle double entry too'); // handle-double-entry-too-1
slugger.slug('Ça va Gérôme ? Là ?'); // ca-va-gerome--la-

Docs

new Slugger()

Create a Slugger instance. Any slug from one instance will be unique.

Parameters:

  • prefix (optional) : any string

Exemples:

const slugger = new Slugger();
const sluggerWithPrefix = new Slugger('my-slug-prefix-');

Slugger.slug

Build one unique slug from given string.

This function will remove every special characters, accents, etc. and keep only lower case letters and numbers.

Parameters:

  • s: any string

Exemples:

slugger.slug('Ça va Gérôme ? Là ?'); // ca-va-gerome--la-

Readme

Keywords

none

Package Sidebar

Install

npm i @anthonypena/slugger

Weekly Downloads

0

Version

1.0.0

License

MIT

Unpacked Size

9.13 kB

Total Files

18

Last publish

Collaborators

  • kuroidoruido