types for url-slugify (#47032)

This commit is contained in:
Tomasz Pluskiewicz 2020-08-28 02:04:42 +02:00 committed by GitHub
parent 2044dd7364
commit 1ffd978095
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 42 additions and 0 deletions

12
types/url-slugify/index.d.ts vendored Normal file
View File

@ -0,0 +1,12 @@
// Type definitions for url-slugify 1.0
// Project: https://github.com/s-barrah/url-slugify#readme
// Definitions by: tpluscode <https://github.com/tpluscode>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
type Separator = '-' | '_' | '~' | "''";
declare class URLSlugify {
slugify(title: string, separator?: Separator): string;
}
export = URLSlugify;

View File

@ -0,0 +1,23 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictFunctionTypes": true,
"strictNullChecks": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"url-slugify-tests.ts"
]
}

View File

@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }

View File

@ -0,0 +1,6 @@
import Slugify = require('url-slugify');
const url: Slugify = new Slugify();
const slug: string = url.slugify('foo');
const slugWithSeparator: string = url.slugify('foo', '_');