DefinitelyTyped/types/parse-full-name/index.d.ts
Nathan Anderson 004c92f2dc
Added types for parse-full-name (#43502)
* added the parse-full-name types

* updated module to not have exported functions and types

* exported the guts of the types as opposed to a single module

* fixed some tests and added a comment for only supporting typescript 3.0

* whoops had a ' that shouldn't have been there

Co-authored-by: n8 <n8@dwell.management>
2020-04-01 13:06:07 -07:00

42 lines
1.1 KiB
TypeScript

// Type definitions for parse-full-name 1.2
// Project: https://github.com/dschnelldavis/parse-full-name
// Definitions by: n8 <https://github.com/n8Guy>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// Minimum TypeScript Version: 3.0
export type partToReturn =
| 'title'
| 'first'
| 'middle'
| 'last'
| 'nick'
| 'suffix'
| 'error'
| 'all';
export interface Name {
title?: string;
first?: string;
middle?: string;
last?: string;
nick?: string;
suffix?: string;
error?: [];
}
/**
* Parses a string containing a person's full name, in any format
* @param nameToParse The name to be parsed
* @param partToReturn The name of a single part to return
* @param fixCase Fix case of output name
* @param stopOnError Makes parsing errors throw JavaScript errors
* @param useLongLists Use long prefix, suffix, and title lists
*/
export function parseFullName(
nameToParse: string,
partToReturn?: partToReturn,
fixCase?: boolean,
stopOnError?: boolean,
useLongLists?: boolean
): Name;