dschnelldavis / parse-full-name

A function that accepts the full name of a person in any format, parses it, and returns its parts { title, first name, middle name, last name, nickname, suffix, [and any parsing errors] }.
74 stars 15 forks source link

Typescript definitions #6

Open sparebytes opened 6 years ago

sparebytes commented 6 years ago

I'll just leave this here for now, until I can make a pull request to include the Typescript definitions.

declare module "parse-full-name" {
    export type PartToReturnSingle = "title" | "first" | "middle" | "last" | "nick" | "suffix" | "error";
    export type PartToReturnAll = "all" | undefined | null;
    export type FixCase = -1 | 0 | 1;

    export interface FullNameParsed {
        title: string;
        first: string;
        middle: string;
        last: string;
        nick: string;
        suffix: string;
        error: string[];
    }

    export function parseFullName(nameToParse: string, partToReturn: PartToReturnSingle, fixCase?: FixCase, stopOnError?: boolean, useLongLists?: boolean): string;
    export function parseFullName(nameToParse: string, partToReturn?: PartToReturnAll, fixCase?: FixCase, stopOnError?: boolean, useLongLists?: boolean): FullNameParsed;
    export function parseFullName(nameToParse: string, partToReturn?: PartToReturnAll | PartToReturnSingle, fixCase?: FixCase, stopOnError?: boolean, useLongLists?: boolean): string | FullNameParsed;
}
sudosoul commented 5 years ago

Thanks, you should consider added this to https://github.com/DefinitelyTyped/DefinitelyTyped - I'll try to once I get some free time

chris-pardy commented 4 years ago

@sparebytes @sudosoul we've taken over ownership of this library I'm moving issues into our fork. Please feel free to comment further on your issue there.