github-slugger-typescript
TypeScript icon, indicating that this package has built-in type declarations

1.1.0 • Public • Published

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

License

MIT

/github-slugger-typescript/

    Package Sidebar

    Install

    npm i github-slugger-typescript

    Weekly Downloads

    2

    Version

    1.1.0

    License

    MIT

    Unpacked Size

    11 kB

    Total Files

    15

    Last publish

    Collaborators

    • hocdoc