Skip to main content
Version: 1.3.1

Class: LastName

Representation of a last name with some extra functionality.

Extends​

Constructors​

Constructor​

new LastName(father, mother?, format?): LastName

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

Some people may keep their

Parameters​

father​

string

mother?​

string

format?​

Surname | "father" | "mother" | "hyphenated" | "all"

Returns​

LastName

Overrides​

Name.constructor

Properties​

capsRange​

protected capsRange: CapsRange

Inherited from​

Name.capsRange


format​

readonly format: Surname | "father" | "mother" | "hyphenated" | "all"


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 father and mother if any.

Returns​

Name[]


father​

Get Signature​

get father(): string

The surname inherited from the father side.

Returns​

string


hasMother​

Get Signature​

get hasMother(): boolean

Returns true if the mother's surname is defined.

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


mother​

Get Signature​

get mother(): string

The surname inherited from the mother side.

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?): LastName

Capitalizes the name.

Parameters​

range?​

CapsRange

Returns​

LastName

Overrides​

Name.caps


copyWith()​

copyWith(values?): LastName

Makes a copy of the current name.

Parameters​

values?​
father?​

string

format?​

Surname

mother?​

string

Returns​

LastName


decaps()​

decaps(range?): LastName

De-capitalizes the name.

Parameters​

range?​

CapsRange

Returns​

LastName

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(format?): string[]

Gets the initials (first character) of this name.

Parameters​

format?​

Surname | "father" | "mother" | "hyphenated" | "all"

Returns​

string[]

Overrides​

Name.initials


toString()​

toString(format?): string

String representation of this object.

Parameters​

format?​

Surname | "father" | "mother" | "hyphenated" | "all"

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