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

Was this helpful?

  1. Wrapper
  2. Wrapped

Wrapped() constructor

PreviousStatic methodsNextInstance methods

Last updated 3 years ago

Was this helpful?

Wrapped()

Creates a new instance of with the specified text and wrap.

wrapped.class.ts
constructor(text: Text, wrap: Wrap<Opening, Closing>) {
  super(Wrapped.template`${text}${wrap}`);
  this.#closing = wrap.closing;
  this.#opening = wrap.opening;
  this.#text = text;
}
Generic type variables

Text extends string

Opening extends string

Closing extends string

Parameters

Name: type
Description

text: Text

The value of a generic type variable Text to be wrapped with a given wrap.

wrap: Wrap<Opening, Closing>

Returns

The return value is a new instance of with the primitive value of the provided text if set properly, otherwise with an empty string.

Example usage

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

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

// Returns Wrapped {'[[OH no, you wrapped me]]'}
new Wrapped(`[OH no, you wrapped me]`, wrap);

// Returns Wrapped{'[]'}
new Wrapped(null as any, wrap);

​A generic type variable constrained by a by default of the value captured from the provided text parameter indicates the text type of via a new instance.

​A generic type variable constrained by a by default of the value captured from the provided wrap parameter indicates the opening type of via a new instance.

​A generic type variable constrained by a by default of the value captured from the provided wrap parameter indicates the closing type of via a new instance.

An instance of to wrap a given text.

Wrapped
Wrapped
string
Wrapped
string
Wrapped
string
Wrapped
Wrap