Skip to main content
Version: 1.3.1

Class: Name

Representation of a string type name with some extra capabilities.

Extended by​

Constructors​

Constructor​

new Name(value, type, capsRange?): Name

Creates augmented names by adding extra functionality to a string name.

Parameters​

value​

string

type​

Namon

must be indicated to categorize the name so it can be treated accordingly.

capsRange?​

CapsRange

determines how the name should be capitalized initially.

Returns​

Name

Properties​

capsRange​

protected capsRange: CapsRange


initial​

protected initial: string


type​

readonly type: Namon

Accessors​

isFirstName​

Get Signature​

get isFirstName(): boolean

Whether the name is a first name.

Returns​

boolean


isLastName​

Get Signature​

get isLastName(): boolean

Whether the name is a last name.

Returns​

boolean


isMiddleName​

Get Signature​

get isMiddleName(): boolean

Whether the name is a middle name.

Returns​

boolean


isPrefix​

Get Signature​

get isPrefix(): boolean

Whether the name is a prefix.

Returns​

boolean


isSuffix​

Get Signature​

get isSuffix(): boolean

Whether the name is a suffix.

Returns​

boolean


length​

Get Signature​

get length(): number

The length of the name.

Returns​

number


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

Methods​

caps()​

caps(range?): Name

Capitalizes the name.

Parameters​

range?​

CapsRange

Returns​

Name


decaps()​

decaps(range?): Name

De-capitalizes the name.

Parameters​

range?​

CapsRange

Returns​

Name


equal()​

equal(other): boolean

Returns true if the other is equal to this name.

Parameters​

other​

unknown

Returns​

boolean


initials()​

initials(): string[]

Gets the initials (first character) of this name.

Returns​

string[]


toString()​

toString(): string

String representation of this object.

Returns​

string


validate()​

protected validate(name?): void

Parameters​

name?​

string

Returns​

void


first()​

static first(value): Name

Creates a first name.

Parameters​

value​

string

Returns​

Name


last()​

static last(value): Name

Creates a last name.

Parameters​

value​

string

Returns​

Name


middle()​

static middle(value): Name

Creates a middle name.

Parameters​

value​

string

Returns​

Name


prefix()​

static prefix(value): Name

Creates a prefix.

Parameters​

value​

string

Returns​

Name


suffix()​

static suffix(value): Name

Creates a suffix.

Parameters​

value​

string

Returns​

Name