angular-package
TwitterGitHub
Wrapper
Wrapper
  • Introduction
  • ❤ Benefits
    • Explanation
    • Designing
  • General concepts
  • Getting started
    • Skeleton
    • Installation
      • npm
    • Public API
    • Basic concepts
  • Wrap {}
    • Overview
    • Generic type variables
    • ★ Constructor
    • Accessors
      • closing
      • opening
      • text
      • [Symbol.toStringTag]
    • Properties
      • #closing
      • #opening
      • #text
    • Methods
      • Static
        • hasClosing()
        • hasOpening()
        • isWrap()
      • Instance
        • getClosing()
        • getOpening()
        • getText()
        • hasClosing()
        • hasOpening()
        • hasText()
        • isWrapped()
        • ★ replaceClosing()
        • ★ replaceOpening()
        • ★ replaceText()
        • toString()
        • valueOf()
    • Example usage
  • Wrapper {}
    • Overview
    • Generic type variables
    • Constructor
    • Accessors
      • [Symbol.toStringTag]
    • Methods
      • Static
        • define()
        • isWrapper()
        • replaceClosing()
        • replaceOpening()
        • unwrap()
      • Instance
        • isClosingIn()
        • isOpeningIn()
        • replaceClosingIn()
        • replaceOpeningIn()
        • removeWrapIn()
        • textReplaceClosing()
        • textReplaceOpening()
        • ⚠ textHasClosing()
        • ⚠ textHasOpening()
        • textUnwrap()
        • textWrap()
        • toArray()
        • toWrap()
        • unwrap()
        • unwrapText()
        • ★ wrap()
        • ★ wrapOn()
        • ★ wrapText()
    • Example usage
  • Type
    • Wrapped
  • Change log
    • Keep a changelog
    • CHANGELOG.md
    • v1.0.0
  • GIT
    • Commit
    • Semantic Versioning
  • License
    • MIT
  • Contact
    • ⋯ Chat
    • @ Email
  • Donate
    • ฿ Cryptocurrency
    • $ Fiat
  • More versions
Powered by GitBook
On this page
  • HtmlWrap
  • OfType

Was this helpful?

  1. Wrapper {}

Example usage

HtmlWrap

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/wrapper';
 
// Define HtmlWrap class.
class HtmlWrap extends Wrapper<`<`, `>`> {
  constructor() {
    super(`<`, `>`);
  }
}

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

OfType

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

// Example usage.
import { Wrapper } from '@angular-package/wrapper';

class OfType extends String {
  constructor(name: string) {
    super(new Wrapper<`:`, ``>(`:`, ``).wrap(` ${name}`));
  }
}

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

// Returns ': Opening'.
ofOpening.valueOf();
Previous★ wrapText()NextWrapped

Last updated 3 years ago

Was this helpful?