From c6f86d519ce91fa805bee4f2eb49263d321cd5b4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Podeszwa?= Date: Tue, 15 Nov 2016 20:32:27 +0100 Subject: [PATCH] Add typings for humanname 1.1.1 (#12641) --- humanparser/humanparser-tests.ts | 19 ++++++++++++++++ humanparser/index.d.ts | 37 ++++++++++++++++++++++++++++++++ humanparser/tsconfig.json | 19 ++++++++++++++++ 3 files changed, 75 insertions(+) create mode 100644 humanparser/humanparser-tests.ts create mode 100644 humanparser/index.d.ts create mode 100644 humanparser/tsconfig.json diff --git a/humanparser/humanparser-tests.ts b/humanparser/humanparser-tests.ts new file mode 100644 index 0000000000..0abe741554 --- /dev/null +++ b/humanparser/humanparser-tests.ts @@ -0,0 +1,19 @@ +import human = require('humanparser'); + +let parsedName = human.parseName("Mr. William R. Hearst, III"); +parsedName.firstName; +parsedName.lastName; +parsedName.fullName; +parsedName.suffix; +parsedName.middleName; +parsedName.salutation; + +let parsedAddress = human.parseAddress("123 Happy Street, Honolulu, HI 65780"); +parsedAddress.address; +parsedAddress.state; +parsedAddress.fullAddress; +parsedAddress.zip; +parsedAddress.city; + +let parsedFullName = human.getFullestName("John & Peggy Sue"); +parsedFullName.fullName; diff --git a/humanparser/index.d.ts b/humanparser/index.d.ts new file mode 100644 index 0000000000..37209a60f3 --- /dev/null +++ b/humanparser/index.d.ts @@ -0,0 +1,37 @@ +// Type definitions for humanparser 1.1.1 +// Project: https://github.com/chovy/humanparser +// Definitions by: MichaƂ Podeszwa +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +declare namespace humanparser { + interface NameOutput { + firstName: string; + lastName: string; + fullName: string; + suffix?: string; + middleName?: string; + salutation?: string; + } + + interface FullerNameOutput { + fullName: string; + } + + interface AddressOutput { + address: string; + state: string; + fullAddress: string; + zip: string; + city: string; + } + + interface HumanparserStatic { + parseName (name: string): NameOutput; + getFullestName (name: string): FullerNameOutput; + parseAddress (address: string): AddressOutput; + } + +} + +declare const humanparser: humanparser.HumanparserStatic; +export = humanparser; diff --git a/humanparser/tsconfig.json b/humanparser/tsconfig.json new file mode 100644 index 0000000000..17b129eba5 --- /dev/null +++ b/humanparser/tsconfig.json @@ -0,0 +1,19 @@ +{ + "compilerOptions": { + "module": "commonjs", + "target": "es6", + "noImplicitAny": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "humanparser-tests.ts" + ] +}