Merge pull request #25901 from AndersonFriaca/jquery-slugify

Types for JQuery Slugify
This commit is contained in:
Daniel Rosenwasser
2018-05-21 21:42:46 -07:00
committed by GitHub
4 changed files with 66 additions and 0 deletions

33
types/jquery-slugify/index.d.ts vendored Normal file
View File

@@ -0,0 +1,33 @@
// Type definitions for jquery-slugify 1.2
// Project: https://github.com/madflow/jquery-slugify
// Definitions by: Anderson Friaça <https://github.com/AndersonFriaca>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
/// <reference types="jquery" />
export type Options = Partial<{
preSlug: ((source: string) => string);
postSlug: ((source: string) => string);
slugFunc: ((input: string, options: Options) => string);
separator: string;
lang: string | boolean;
symbols: boolean;
maintainCase: boolean;
titleCase: string[] | boolean;
truncate: number;
uric: boolean;
uricNoSlash: boolean;
mark: boolean;
custom: string[];
}>;
declare global {
interface JQuery {
slugify(source: string, options?: Options): JQuery;
}
interface JQueryStatic {
slugify(source: string, options?: Options): string;
}
}

View File

@@ -0,0 +1,7 @@
$.slugify("jquery slugify");
$('#slug-target').slugify('#slug-source');
$("#slug-target").slugify("#slug-source", {
separator: '_'
});

View File

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

View File

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