5.0.8 • Published 2 months ago

@types/slug v5.0.8

Weekly downloads
14,689
License
MIT
Repository
github
Last release
2 months ago

Installation

npm install --save @types/slug

Summary

This package contains type definitions for slug (https://github.com/trott/node-slug).

Details

Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/slug.

index.d.ts

// Type definitions for slug 5.0
// Project: https://github.com/trott/node-slug
// Definitions by: Mohamed Hegazy <https://github.com/mhegazy>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped

export = slug;
export as namespace slug;

declare function slug(string: string, replacement: string): string;
declare function slug(string: string, opts?: slug.Options): string;

declare namespace slug {
    const charmap: CharMap;
    const defaults: {
        charmap: CharMap;
        mode: string;
        modes: {
            pretty: Mode;
            rfc3986: Mode;
        };
        multicharmap: CharMap;
    };
    const multicharmap: CharMap;

    function extend(entry: CharMap): void;
    function reset(): void;

    interface Mode {
        charmap?: CharMap | null | undefined;
        lower?: boolean | null | undefined;
        multicharmap?: CharMap | null | undefined;
        remove?: RegExp | null | undefined;
        replacement?: string | null | undefined;
        symbols?: boolean | null | undefined;
        trim?: boolean | null | undefined;
    }

    type Options = {
        locale?: string | undefined;
    } & Partial<Mode>;

    type CharMap = Record<string, string>;
}

Additional Details

  • Last updated: Fri, 03 Dec 2021 18:31:06 GMT
  • Dependencies: none
  • Global values: slug

Credits

These definitions were written by Mohamed Hegazy.