Skip to main content
Version: 1.3.1

Class: FullName

The core component of this utility.

This component is composed of five entities that make it easy to handle a full name set: prefix, first name, middle name, last name, and suffix. It is indeed intended for internal processes. However, it is understandable that it might be needed at some point for additional purposes. For this reason, it's made available.

It is recommended to avoid using this class unless it is highly necessary or a custom parser is used for uncommon use cases although this utility tries to cover as many use cases as possible.

Additionally, an optional configuration can be used to indicate some specific behaviors related to that name handling.

Constructors​

Constructor​

new FullName(options?): FullName

Creates a full name as it goes

Parameters​

options?​

Partial<Config>

settings for additional features.

Returns​

FullName

Accessors​

config​

Get Signature​

get config(): Config

A snapshot of the configuration used to set up this full name.

Returns​

Config


firstName​

Get Signature​

get firstName(): FirstName

The first name part of the full name.

Returns​

FirstName


lastName​

Get Signature​

get lastName(): LastName

The last name part of the full name.

Returns​

LastName


middleName​

Get Signature​

get middleName(): Name[]

The middle name part of the full name.

Returns​

Name[]


prefix​

Get Signature​

get prefix(): Name

The prefix part of the full name.

Returns​

Name


suffix​

Get Signature​

get suffix(): Name

The suffix part of the full name.

Returns​

Name

Methods​

[iterator]()​

[iterator](): Iterator<Name>

Returns the default iterator for this name set (enabling for-of statements).

Returns​

Iterator<Name>


has()​

has(key): boolean

Returns true if a namon has been set.

Parameters​

key​

string | Namon

Returns​

boolean


setFirstName()​

setFirstName(name): FullName

Parameters​

name​

string | FirstName

Returns​

FullName


setLastName()​

setLastName(name): FullName

Parameters​

name​

string | LastName

Returns​

FullName


setMiddleName()​

setMiddleName(names): FullName

Parameters​

names​

Name[] | string[]

Returns​

FullName


setPrefix()​

setPrefix(name): FullName

Parameters​

name​

string | Name

Returns​

FullName


setSuffix()​

setSuffix(name): FullName

Parameters​

name​

string | Name

Returns​

FullName


toIterable()​

toIterable(flat?): Iterable<Name>

Returns an Iterable of existing Names.

Parameters​

flat?​

boolean

Returns​

Iterable<Name>


toString()​

toString(): string

Returns​

string


parse()​

static parse(json, config?): FullName

Parses a JSON name into a full name.

Parameters​

json​

JsonName

parsable name element

config?​

Config

for additional features.

Returns​

FullName