diff --git a/types/jquery-slugify/index.d.ts b/types/jquery-slugify/index.d.ts new file mode 100644 index 0000000000..2bb0da56e1 --- /dev/null +++ b/types/jquery-slugify/index.d.ts @@ -0,0 +1,33 @@ +// Type definitions for jquery-slugify 1.2 +// Project: https://github.com/madflow/jquery-slugify +// Definitions by: Anderson Friaça +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 + +/// + +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; + } +} diff --git a/types/jquery-slugify/jquery-slugify-tests.ts b/types/jquery-slugify/jquery-slugify-tests.ts new file mode 100644 index 0000000000..af19a4b635 --- /dev/null +++ b/types/jquery-slugify/jquery-slugify-tests.ts @@ -0,0 +1,7 @@ +$.slugify("jquery slugify"); + +$('#slug-target').slugify('#slug-source'); + +$("#slug-target").slugify("#slug-source", { + separator: '_' +}); diff --git a/types/jquery-slugify/tsconfig.json b/types/jquery-slugify/tsconfig.json new file mode 100644 index 0000000000..1b5b101efc --- /dev/null +++ b/types/jquery-slugify/tsconfig.json @@ -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" + ] +} \ No newline at end of file diff --git a/types/jquery-slugify/tslint.json b/types/jquery-slugify/tslint.json new file mode 100644 index 0000000000..d04fe2e1fa --- /dev/null +++ b/types/jquery-slugify/tslint.json @@ -0,0 +1 @@ +{"extends": "dtslint/dt.json"} \ No newline at end of file