Instance methods

Public

Wrap.prototype.getClosing()

Gets the closing chars of the wrap by returning the #closing property of a specified object.

wrap.class.ts
public getClosing(): Closing {
  return this.#closing;
}

Returns

The return value is closing chars of a generic type variable Closing.

Example usage

// Example usage.
import { Wrap } from '@angular-package/text';

// Returns ] of type "]".
new Wrap(`[`, `]`).getClosing();

Wrap.prototype.getOpening()

Gets the opening chars of the wrap by returning the #opening property of a specified object.

Returns

The return value is opening chars of a generic type variable Opening.

Example usage

Wrap.prototype.getText()

Gets the text of the wrap by returning the #text property of a specified object, without the opening and closing chars of the Wrap.

Returns

The return value is the text of a generic type variable Text.

Example usage

Wrap.prototype.hasClosing()

Checks whether the primitive value of a specified object has the closing chars or given closing chars. An empty string indicates undefinedarrow-up-right.

Parameters

Name: type
Description

closing?: string

Optional closing chars of a string type to check whether the primitive value contains them at the end.

Returns

The return value is a booleanarrow-up-right indicating whether the primitive value has the closing chars.

Functions used

isStringLength(), isStringType()

Example usage

Wrap.prototype.hasOpening()

Checks whether the primitive value of a specified object has the opening chars or given opening chars. An empty string indicates undefinedarrow-up-right.

Parameters

Name: type
Description

opening?: string

Optional opening chars of a string type to check if the primitive value contains them at the beginning.

Returns

The return value is a booleanarrow-up-right indicating whether the primitive value has the opening chars.

Functions used

isStringLength(), isStringType()

Example usage

Wrap.prototype.hasText()

The method checks whether the text of a specified Wrap object is defined, which means it's a string of at least one char and optionally equal to the given text.

Parameters

Name: type
Description

text?: string

Optional text of string type to check whether it's equal to the text of the Wrap object.

Returns

The return value is a booleanarrow-up-right indicating whether the text is defined and equal to the optionally given text.

Functions used

isStringLength(), isStringType()

Example usage

Wrap.prototype.isWrapped()

The method checks whether the primitive value of the specified object is wrapped by the opening and closing chars of an instance or given opening and closing chars.

Parameters

Name: type
Description

opening: string

Optional closing chars of a string type to check if the text contains them at the end.

closing: string

Optional closing chars of a string type to check if the text contains them at the end.

Returns

The return value is a booleanarrow-up-right indicating whether the object has both opening and closing chars.

Example usage

Wrap.prototype.replaceClosing()

Returns the primitive value with replaced closing chars.

Generic type variables

ReplaceClosing extends string

A generic type variable constrained by the stringarrow-up-right, by default of the value captured from the provided closing indicates the ReplaceClosing type on template of the return type.

Parameters

Name: type
Description

closing: replaceClosing

The closing chars of a generic type variable ReplaceClosing to replace the closing chars in the primitive value.

Returns

The return value is the primitive value with replaced closing chars of a generic type variables in order Opening, Text and ReplaceClosing on the template ${Opening}${Text}${ReplaceClosing}.

Example usage

Wrap.prototype.replaceOpening()

Returns the primitive value with replaced opening chars.

Generic type variables

ReplaceOpening extends string

A generic type variable constrained by the stringarrow-up-right, by default of the value captured from the provided opening indicates the ReplaceOpening type on template of the return type.

Parameters

Name: type
Description

opening: ReplaceOpening

The opening chars of a generic type variable ReplaceOpening to replace the opening chars in the primitive value.

Returns

The return value is the primitive value with replaced opening chars of a generic type variables in order ReplaceOpening, Text and Closing on the template ${ReplaceOpening}${Text}${Closing}.

Example usage

Wrap.prototype.replaceText()

Returns the primitive value with replaced text.

Generic type variables

ReplaceText extends string

A generic type variable constrained by the stringarrow-up-right, by default of the value captured from the provided text indicates the ReplaceText type on template of the return type.

Parameters

Name: type
Description

text: ReplaceText

The text of a generic type variable ReplaceText to replace the text in the primitive value.

Returns

The return value is the primitive value with replaced text of a generic type variables in order Opening, ReplaceText and Closing on the template ${Opening}${ReplaceText}${Closing}.

Example usage

Wrap.prototype.toString()

Gets the wrap, the primitive value of a specified Wrap object.

Returns

The return value is the wrap of generic type variables in order Opening, Text, and Closing on the template ${Opening}${Content}${Closing}.

Example usage

Wrap.prototype.valueOf()

Returns the wrap, primitive value of a specified Wrap object.

Returns

The return value is the wrap of generic type variables in order Opening, Text, and Closing on the template ${Opening}${Text}${Closing}.

Example usage

Last updated