github-slugger-typescript
v1.1.0
Published
This project is a small Typescript fork of the [github-slugger](https://github.com/Flet/github-slugger) Javascript library from Dan Flettre.
Downloads
42
Readme
github-slugger-typescript
This project is a small Typescript fork of the github-slugger Javascript library from Dan Flettre.
The original library offers more options (maintainCase
, reset()
) that I don't need.
This project was bootstrapped with TSDX.
Install
npm install github-slugger-typescript
Usage
Keeping track of the previously slugged strings:
import { GithubSlugger } from 'github-slugger-typescript';
const slugger = new GithubSlugger();
slugger.slug("foo"); // foo
slugger.slug("Foo Bar"); // foo-bar
slugger.slug("foo"); // foo-1
slugger.slug("foo"); // foo-2
Useage without keeping track of previously slugged strings:
import { slug } from 'github-slugger-typescript';
slug("foo"); // foo
slug("Foo Bar"); // foo-bar
slug("foo"); // foo