From 9beda1efac5d277b370a77b7c7c16bac706af2cf Mon Sep 17 00:00:00 2001 From: doniyor2109 Date: Fri, 15 Feb 2019 11:47:32 +0500 Subject: [PATCH] Added type definition for natural-compare --- types/natural-compare-lite/index.d.ts | 14 +++++++++++ .../natural-compare-lite-tests.ts | 10 ++++++++ types/natural-compare-lite/tsconfig.json | 23 +++++++++++++++++++ types/natural-compare-lite/tslint.json | 3 +++ types/natural-compare/index.d.ts | 14 +++++++++++ .../natural-compare/natural-compare-tests.ts | 10 ++++++++ types/natural-compare/tsconfig.json | 23 +++++++++++++++++++ types/natural-compare/tslint.json | 3 +++ 8 files changed, 100 insertions(+) create mode 100644 types/natural-compare-lite/index.d.ts create mode 100644 types/natural-compare-lite/natural-compare-lite-tests.ts create mode 100644 types/natural-compare-lite/tsconfig.json create mode 100644 types/natural-compare-lite/tslint.json create mode 100644 types/natural-compare/index.d.ts create mode 100644 types/natural-compare/natural-compare-tests.ts create mode 100644 types/natural-compare/tsconfig.json create mode 100644 types/natural-compare/tslint.json diff --git a/types/natural-compare-lite/index.d.ts b/types/natural-compare-lite/index.d.ts new file mode 100644 index 0000000000..5e1a10bbdb --- /dev/null +++ b/types/natural-compare-lite/index.d.ts @@ -0,0 +1,14 @@ +// Type definitions for natural-compare-lite 1.4.0 +// Project: https://github.com/litejs/natural-compare-lite +// Definitions by: Doniyor Aliyev +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +declare function naturalCompare(a: string, b: string): number; + +declare global { + interface StringConstructor { + naturalCompare: typeof naturalCompare; + } +} + +export = naturalCompare; diff --git a/types/natural-compare-lite/natural-compare-lite-tests.ts b/types/natural-compare-lite/natural-compare-lite-tests.ts new file mode 100644 index 0000000000..dc483b4bcd --- /dev/null +++ b/types/natural-compare-lite/natural-compare-lite-tests.ts @@ -0,0 +1,10 @@ +// Type definitions for natural-compare-lite 1.4.0 +// Project: https://github.com/litejs/natural-compare-lite +// Definitions by: Doniyor Aliyev +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +import compare = require("natural-compare-lite"); + +['a', 's', 'd'].sort(compare); + +['a', 's', 'd'].sort(String.naturalCompare); diff --git a/types/natural-compare-lite/tsconfig.json b/types/natural-compare-lite/tsconfig.json new file mode 100644 index 0000000000..e3ed3ac1e0 --- /dev/null +++ b/types/natural-compare-lite/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": false, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "natural-compare-lite-tests.ts" + ] +} diff --git a/types/natural-compare-lite/tslint.json b/types/natural-compare-lite/tslint.json new file mode 100644 index 0000000000..f93cf8562a --- /dev/null +++ b/types/natural-compare-lite/tslint.json @@ -0,0 +1,3 @@ +{ + "extends": "dtslint/dt.json" +} diff --git a/types/natural-compare/index.d.ts b/types/natural-compare/index.d.ts new file mode 100644 index 0000000000..57e0999157 --- /dev/null +++ b/types/natural-compare/index.d.ts @@ -0,0 +1,14 @@ +// Type definitions for natural-compare 1.4.0 +// Project: https://github.com/litejs/natural-compare-lite +// Definitions by: Doniyor Aliyev +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +declare function naturalCompare(a: string, b: string): number; + +declare global { + interface StringConstructor { + naturalCompare: typeof naturalCompare; + } +} + +export = naturalCompare; diff --git a/types/natural-compare/natural-compare-tests.ts b/types/natural-compare/natural-compare-tests.ts new file mode 100644 index 0000000000..59e7d53163 --- /dev/null +++ b/types/natural-compare/natural-compare-tests.ts @@ -0,0 +1,10 @@ +// Type definitions for natural-compare 1.4.0 +// Project: https://github.com/litejs/natural-compare-lite +// Definitions by: Doniyor Aliyev +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +import compare = require("natural-compare"); + +['a', 's', 'd'].sort(compare); + +['a', 's', 'd'].sort(String.naturalCompare); diff --git a/types/natural-compare/tsconfig.json b/types/natural-compare/tsconfig.json new file mode 100644 index 0000000000..81322d5590 --- /dev/null +++ b/types/natural-compare/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": false, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "natural-compare-tests.ts" + ] +} diff --git a/types/natural-compare/tslint.json b/types/natural-compare/tslint.json new file mode 100644 index 0000000000..f93cf8562a --- /dev/null +++ b/types/natural-compare/tslint.json @@ -0,0 +1,3 @@ +{ + "extends": "dtslint/dt.json" +}