Instance methods

Public

Wrapped.prototype.unwrap()

Returns an unwrapped text, without the opening, and closing character of the wrap.

public unwrap(): Text {
  return this.#text;
}

Example usage

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

const wrap = new Wrap(`[`, `]`);

// Returns 'Oh no, I am wrapped'
new Wrapped(`Oh no, I am wrapped`, wrap).unwrap();

// Returns '[Oh no, I am wrapped]'
new Wrapped(`[Oh no, I am wrapped]`, wrap).unwrap();

Wrapped.prototype.valueOf()

Gets wrapped text, the primitive value of a specified object.

public valueOf(): WrappedText<Text, Opening, Closing> {
  return super.valueOf() as WrappedText<Text, Opening, Closing>;
}

Returns

The return value is a generic type WrappedText, or an empty string.

Example usage

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

const wrap = new Wrap(`[`, `]`);

// Returns '[Oh no, I am wrapped]'
new Wrapped(`Oh no, I am wrapped`, wrap).valueOf();

Last updated