diff --git a/types/bcp-47-match/bcp-47-match-tests.ts b/types/bcp-47-match/bcp-47-match-tests.ts new file mode 100644 index 0000000000..576779aa37 --- /dev/null +++ b/types/bcp-47-match/bcp-47-match-tests.ts @@ -0,0 +1,17 @@ +import bcp47Match = require('bcp-47-match'); + +const basic = bcp47Match.basicFilter; +const extended = bcp47Match.extendedFilter; +const lookup = bcp47Match.lookup; + +const tags = ['en', 'es']; +const ranges = ['en-US', 'es-US']; + +const basicResult1: string[] = basic(tags, ranges); +const basicResult2: string[] = basic(tags[0], ranges[0]); + +const extendedResult1: string[] = extended(tags, ranges); +const extendedResult2: string[] = extended(tags[0], ranges[0]); + +const lookupResult1: string | undefined = lookup(tags, ranges); +const lookupResult2: string | undefined = lookup(tags[0], ranges[0]); diff --git a/types/bcp-47-match/index.d.ts b/types/bcp-47-match/index.d.ts new file mode 100644 index 0000000000..54f4cc5182 --- /dev/null +++ b/types/bcp-47-match/index.d.ts @@ -0,0 +1,8 @@ +// Type definitions for bcp-47-match 1.0 +// Project: https://github.com/wooorm/bcp-47-match#readme +// Definitions by: Chris Barth +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +export function basicFilter(tags: string | string[], ranges: string | string[]): string[]; +export function extendedFilter(tags: string | string[], ranges: string | string[]): string[]; +export function lookup(tags: string | string[], ranges: string | string[]): string | undefined; diff --git a/types/bcp-47-match/tsconfig.json b/types/bcp-47-match/tsconfig.json new file mode 100644 index 0000000000..973220ab34 --- /dev/null +++ b/types/bcp-47-match/tsconfig.json @@ -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", + "bcp-47-match-tests.ts" + ] +} diff --git a/types/bcp-47-match/tslint.json b/types/bcp-47-match/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/bcp-47-match/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" }