From f9be2e89f022fbf9f1021b30b3ebf16598d8cebd Mon Sep 17 00:00:00 2001 From: Alexander T Date: Tue, 29 Oct 2019 06:13:05 +0200 Subject: [PATCH] transliteration: Provides its own types (#39556) --- notNeededPackages.json | 6 ++ types/transliteration/index.d.ts | 68 ------------------- .../transliteration/transliteration-tests.ts | 40 ----------- types/transliteration/tsconfig.json | 23 ------- types/transliteration/tslint.json | 1 - 5 files changed, 6 insertions(+), 132 deletions(-) delete mode 100644 types/transliteration/index.d.ts delete mode 100644 types/transliteration/transliteration-tests.ts delete mode 100644 types/transliteration/tsconfig.json delete mode 100644 types/transliteration/tslint.json diff --git a/notNeededPackages.json b/notNeededPackages.json index 529c094f47..02eb629da9 100644 --- a/notNeededPackages.json +++ b/notNeededPackages.json @@ -4158,6 +4158,12 @@ "sourceRepoURL": "https://github.com/sindresorhus/to-semver", "asOfVersion": "2.0.0" }, + { + "libraryName": "transliteration", + "typingsPackageName": "transliteration", + "sourceRepoURL": "https://github.com/dzcpy/transliteration", + "asOfVersion": "1.6.6" + }, { "libraryName": "trash", "typingsPackageName": "trash", diff --git a/types/transliteration/index.d.ts b/types/transliteration/index.d.ts deleted file mode 100644 index 3bb9793054..0000000000 --- a/types/transliteration/index.d.ts +++ /dev/null @@ -1,68 +0,0 @@ -// Type definitions for transliteration 1.6 -// Project: https://github.com/dzcpy/transliteration -// Definitions by: Anthony Trinh -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - -export function transliterate(str: string, options?: transliterate.Options): string; - -export namespace transliterate { - /** - * Bind options globally so any following calls will be using - * optionsObj by default. If optionsObj argument is omitted, - * it will return current default option object. - */ - function config(optionsObj?: Options): Options; - - interface Options { - /** - * Unicode characters that are not in the database will be replaced with `unknown` - * default: "[?]" - */ - unknown?: string; - - /** - * Custom replacement of the strings before transliteration - */ - replace?: string[][] | {[source: string]: string}; - - /** - * Strings in the ignore list will be bypassed from transliteration - */ - ignore?: string[]; - } -} - -export function slugify(str: string, options?: slugify.Options): string; - -export namespace slugify { - /** - * Bind options globally so any following calls will be using - * optionsObj by default. If optionsObj argument is omitted, - * it will return current default option object. - */ - function config(optionsObj?: Options): Options; - - interface Options { - /** - * Whether to force slugs to be lowercased - * default: true - */ - lowercase?: boolean; - - /** - * Separator of the slug - * default: "-" - */ - separator?: string; - - /** - * Custom replacement of the strings before transliteration - */ - replace?: string[][] | {[source: string]: string}; - - /** - * Strings in the ignore list will be bypassed from transliteration - */ - ignore?: string[]; - } -} diff --git a/types/transliteration/transliteration-tests.ts b/types/transliteration/transliteration-tests.ts deleted file mode 100644 index fd9bef63c1..0000000000 --- a/types/transliteration/transliteration-tests.ts +++ /dev/null @@ -1,40 +0,0 @@ -import { transliterate as tr, slugify } from 'transliteration'; - -tr('你好,世界'); // Ni Hao , Shi Jie -tr('Γεια σας, τον κόσμο'); // Geia sas, ton kosmo -tr('안녕하세요, 세계'); // annyeonghaseyo, segye -tr('你好,世界', { replace: {你: 'You'}, ignore: ['好'] }); // You 好, Shi Jie -tr('你好,世界', { replace: [['你', 'You']], ignore: ['好'] }); // You 好, Shi Jie (option in array form) -// or use configurations -tr.config({ replace: [['你', 'You']], ignore: ['好'] }); -tr('你好,世界'); // You 好, Shi Jie -// get configurations -const opt1 = tr.config(); -opt1.ignore = ['foo', 'bar', 'baz']; -opt1.ignore = undefined; -opt1.replace = [['a', 'foo'], ['b', 'bar']]; -opt1.replace = {a: 'foo', b: 'bar', c: 'baz'}; -opt1.replace = undefined; -opt1.unknown = '***?***'; -opt1.unknown = undefined; - -slugify('你好,世界'); // ni-hao-shi-jie -slugify('你好,世界', { lowercase: false, separator: '_' }); // Ni_Hao_Shi_Jie -slugify('你好,世界', { replace: {你好: 'Hello', 世界: 'world'}, separator: '_' }); // hello_world -slugify('你好,世界', { replace: [['你好', 'Hello'], ['世界', 'world']], separator: '_' }); // hello_world (option in array form) -slugify('你好,世界', { ignore: ['你好'] }); // 你好shi-jie -// or use configurations -slugify.config({ lowercase: false, separator: '_' }); -slugify('你好,世界'); // Ni_Hao_Shi_Jie -// get configurations -const opt2 = slugify.config(); -opt2.ignore = ['foo', 'bar', 'baz']; -opt2.ignore = undefined; -opt2.replace = [['a', 'foo'], ['b', 'bar']]; -opt2.replace = {a: 'foo', b: 'bar', c: 'baz'}; -opt2.replace = undefined; -opt2.lowercase = false; -opt2.lowercase = true; -opt2.lowercase = undefined; -opt2.separator = ';'; -opt2.separator = undefined; diff --git a/types/transliteration/tsconfig.json b/types/transliteration/tsconfig.json deleted file mode 100644 index 152b73f04a..0000000000 --- a/types/transliteration/tsconfig.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "compilerOptions": { - "module": "commonjs", - "lib": [ - "es5" - ], - "noImplicitAny": true, - "noImplicitThis": true, - "strictNullChecks": true, - "strictFunctionTypes": true, - "baseUrl": "../", - "typeRoots": [ - "../" - ], - "types": [], - "noEmit": true, - "forceConsistentCasingInFileNames": true - }, - "files": [ - "index.d.ts", - "transliteration-tests.ts" - ] -} diff --git a/types/transliteration/tslint.json b/types/transliteration/tslint.json deleted file mode 100644 index 3db14f85ea..0000000000 --- a/types/transliteration/tslint.json +++ /dev/null @@ -1 +0,0 @@ -{ "extends": "dtslint/dt.json" }