angular-package
TwitterGitHub
Text
Text
  • Introduction
  • Benefits
  • Getting started
    • General concepts
    • Skeleton
    • Installation
    • Public API
  • Wrapper
    • Basic concepts
    • Wrap
      • Generic type variables
      • Instance accessors
      • Instance properties
      • Static methods
      • Wrap() constructor
      • Instance methods
      • Examples
    • Wrapper
      • Generic type variables
      • Static properties
      • Instance accessors
      • Static methods
      • Wrapper() constructor
      • Instance methods
      • Examples
    • Wrapped
      • Generic type variables
      • Instance accessors
      • Instance properties
      • Static methods
      • Wrapped() constructor
      • Instance methods
      • Types
      • Examples
  • Tag
    • Basic concepts
    • Tag
      • Generic type variables
      • Static accessors
      • Static properties
      • Instance accessors
      • Instance properties
      • Static methods
      • Tag() constructor
      • Instance methods
      • Types
      • Examples
    • BBCodeTag
      • Static methods
      • BBCodeTag() constructor
    • HtmlTag
      • Generic type variables
      • HtmlTag() constructor
    • Tags
    • Tagged
  • Main
    • AllowedChars
    • Attribute
      • Generic type variables
      • Instance accessors
      • Instance properties
      • Static methods
      • Attribute() constructor
      • Instance methods
    • Attributes
    • Template
    • Text
  • Legend
    • Property tags
  • Other
    • Contact
    • Sponsor
  • More versions
Powered by GitBook
On this page
  • Public
  • Wrapped.prototype.unwrap()
  • Wrapped.prototype.valueOf()

Was this helpful?

  1. Wrapper
  2. Wrapped

Instance methods

PreviousWrapped() constructorNextTypes

Last updated 3 years ago

Was this helpful?

Public

Wrapped.prototype.unwrap()

Returns an unwrapped text, without the , and 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();
opening
closing