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. Wrapper

Examples

Let's create a new HtmlWrap object extending it with the Wrapper to make an immutable <span> tag.

// Example usage.
import { Wrapper } from '@angular-package/text';
 
// Define HtmlWrap class.
class HtmlWrap extends Wrapper<`<`, `>`> {
  constructor() {
    super(`<`, `>`);
  }
}

// Create the html tag '<span>'.
new HtmlWrap().wrapText(`span`).value;

Create a new object OfType to make an immutable string indicating of type : Opening.

// Example usage.
import { Wrapper } from '@angular-package/text';
 
class OfType extends String {
  constructor(name: string) {
    super(new Wrapper<`:`, ``>(`:`, ``).wrapText(` ${name}`));
  }
}

// Returns OfType{': Opening'}.
const ofOpening = new OfType(`Opening`);

// Returns ': Opening'.
ofOpening.valueOf();
PreviousInstance methodsNextWrapped

Last updated 3 years ago

Was this helpful?