Skip to main content
Version: 2.2.0

Class: Mononym

A single word name or mononym.

This is a special case of FullName that is used to represent mononyms. This contradicts the original purpose of this library such as shaping and organizing name pieces accordingly.

When enabled via Config.mono, this becomes the full name of a human. And as a single name, most of the Namefully methods become irrelevant.

Extends​

Constructors​

Constructor​

new Mononym(name, options?): Mononym

Constructs a mononym from a piece of string.

Parameters​

name​

string | Name

to be used to construct the mononym.

options?​

Partial<Config>

Returns​

Mononym

Overrides​

FullName.constructor

Accessors​

config​

Get Signature​

get config(): Config

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

Returns​

Config

Inherited from​

FullName.config


firstName​

Get Signature​

get firstName(): FirstName

The first name part of the full name.

Returns​

FirstName

Inherited from​

FullName.firstName


isMono​

Get Signature​

get isMono(): boolean

Whether the full name is a single word name.

Returns​

boolean

Inherited from​

FullName.isMono


lastName​

Get Signature​

get lastName(): LastName

The last name part of the full name.

Returns​

LastName

Inherited from​

FullName.lastName


middleName​

Get Signature​

get middleName(): Name[]

The middle name part of the full name.

Returns​

Name[]

Inherited from​

FullName.middleName


prefix​

Get Signature​

get prefix(): Name

The prefix part of the full name.

Returns​

Name

Inherited from​

FullName.prefix


suffix​

Get Signature​

get suffix(): Name

The suffix part of the full name.

Returns​

Name

Inherited from​

FullName.suffix


type​

Get Signature​

get type(): Namon

The type of name being used to represent the mononym.

Returns​

Namon

Set Signature​

set type(type): void

Re-assigns which name type is being used to represent the mononym.

Ideally, this doesn't really matter as the mononym is always a single piece of name. When used as string, it must be a valid Namon type or else it will default to Namon.FIRST_NAME.

Parameters​
type​

string | Namon

of name to use.

Returns​

void


value​

Get Signature​

get value(): string

The piece of string treated as a name.

Returns​

string

Methods​

[iterator]()​

[iterator](): Iterator<Name>

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

Returns​

Iterator<Name>

Inherited from​

FullName.[iterator]


has()​

has(key): boolean

Returns true if a namon has been set.

Parameters​

key​

string | Namon

Returns​

boolean

Inherited from​

FullName.has


setFirstName()​

setFirstName(name): FullName

Parameters​

name​

string | FirstName

Returns​

FullName

Inherited from​

FullName.setFirstName


setLastName()​

setLastName(name): FullName

Parameters​

name​

string | LastName

Returns​

FullName

Inherited from​

FullName.setLastName


setMiddleName()​

setMiddleName(names): FullName

Parameters​

names​

Name[] | string[]

Returns​

FullName

Inherited from​

FullName.setMiddleName


setPrefix()​

setPrefix(name): FullName

Parameters​

name​

string | Name

Returns​

FullName

Inherited from​

FullName.setPrefix


setSuffix()​

setSuffix(name): FullName

Parameters​

name​

string | Name

Returns​

FullName

Inherited from​

FullName.setSuffix


toIterable()​

toIterable(flat?): Iterable<Name>

Returns an Iterable of existing Names.

Parameters​

flat?​

boolean

Returns​

Iterable<Name>

Inherited from​

FullName.toIterable


toString()​

toString(): string

Returns​

string

Inherited from​

FullName.toString


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

Inherited from​

FullName.parse