Skip to main content
Version: 2.2.0

Class: FirstName

Representation of a first name with some extra functionality.

Extends​

Constructors​

Constructor​

new FirstName(value, ...more): FirstName

Creates an extended version of Name and flags it as a first name type.

Some may consider more additional name parts of a given name as their first names, but not as their middle names. Though it may mean the same, more provides the freedom to do it as it pleases.

Parameters​

value​

string

more​

...string[]

Returns​

FirstName

Overrides​

Name.constructor

Properties​

capsRange​

protected capsRange: CapsRange

Inherited from​

Name.capsRange


initial​

protected initial: string

Inherited from​

Name.initial


type​

readonly type: Namon

Inherited from​

Name.type

Accessors​

asNames​

Get Signature​

get asNames(): Name[]

Returns a combined version of the value and more if any.

Returns​

Name[]


hasMore​

Get Signature​

get hasMore(): boolean

Determines whether a first name has more name parts.

Returns​

boolean


isFirstName​

Get Signature​

get isFirstName(): boolean

Whether the name is a first name.

Returns​

boolean

Inherited from​

Name.isFirstName


isLastName​

Get Signature​

get isLastName(): boolean

Whether the name is a last name.

Returns​

boolean

Inherited from​

Name.isLastName


isMiddleName​

Get Signature​

get isMiddleName(): boolean

Whether the name is a middle name.

Returns​

boolean

Inherited from​

Name.isMiddleName


isPrefix​

Get Signature​

get isPrefix(): boolean

Whether the name is a prefix.

Returns​

boolean

Inherited from​

Name.isPrefix


isSuffix​

Get Signature​

get isSuffix(): boolean

Whether the name is a suffix.

Returns​

boolean

Inherited from​

Name.isSuffix


length​

Get Signature​

get length(): number

The length of the name.

Returns​

number

Overrides​

Name.length


more​

Get Signature​

get more(): string[]

The additional name parts of the first name.

Returns​

string[]


value​

Get Signature​

get value(): string

The piece of string treated as a name.

Returns​

string

Set Signature​

set value(newValue): void

Parameters​
newValue​

string

Returns​

void

Inherited from​

Name.value

Methods​

caps()​

caps(range?): FirstName

Capitalizes the name.

Parameters​

range?​

CapsRange

Returns​

FirstName

Overrides​

Name.caps


copyWith()​

copyWith(values?): FirstName

Makes a copy of the current name.

Parameters​

values?​
first?​

string

more?​

string[]

Returns​

FirstName


decaps()​

decaps(range?): FirstName

De-capitalizes the name.

Parameters​

range?​

CapsRange

Returns​

FirstName

Overrides​

Name.decaps


equal()​

equal(other): boolean

Returns true if the other is equal to this name.

Parameters​

other​

unknown

Returns​

boolean

Inherited from​

Name.equal


initials()​

initials(withMore?): string[]

Gets the initials (first character) of this name.

Parameters​

withMore?​

boolean

Returns​

string[]

Overrides​

Name.initials


toString()​

toString(withMore?): string

String representation of this object.

Parameters​

withMore?​

boolean

Returns​

string

Overrides​

Name.toString


validate()​

protected validate(name?): void

Parameters​

name?​

string

Returns​

void

Inherited from​

Name.validate


first()​

static first(value): Name

Creates a first name.

Parameters​

value​

string

Returns​

Name

Inherited from​

Name.first


last()​

static last(value): Name

Creates a last name.

Parameters​

value​

string

Returns​

Name

Inherited from​

Name.last


middle()​

static middle(value): Name

Creates a middle name.

Parameters​

value​

string

Returns​

Name

Inherited from​

Name.middle


prefix()​

static prefix(value): Name

Creates a prefix.

Parameters​

value​

string

Returns​

Name

Inherited from​

Name.prefix


suffix()​

static suffix(value): Name

Creates a suffix.

Parameters​

value​

string

Returns​

Name

Inherited from​

Name.suffix