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
  • Wrapper.prototype.textWrap()
  • Generic type variables
  • Parameters
  • Return type
  • Returns
  • Example usage

Was this helpful?

  1. Wrapper {}
  2. Methods
  3. Instance

textWrap()

PrevioustextUnwrap()NexttoArray()

Last updated 3 years ago

Was this helpful?

Wrapper.prototype.textWrap()

The method returns the of the object wrapped by the given and chars.

wrapper.class.ts
public textWrap<TextOpening extends string, TextClosing extends string>(
  opening: TextOpening,
  closing: TextClosing
): Wrapped<TextOpening, Text, TextClosing> {
  return new Wrap(opening, closing, this.text).valueOf();
}

Generic type variables

TextOpeningextendsstring

A generic type variable constrained by the , by default of the value captured from the provided indicates the type of the opening chars in generic type via .

TextClosingextendsstring

A generic type variable constrained by the , by default of the value captured from the provided indicates the type of the closing chars in generic type via .

Parameters

opening: TextOpening

closing: TextClosing

Return type

Wrapped<TextOpening, Text, TextClosing>

Returns

Example usage

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

const longText = new Wrapper('{', '}', '{This is a long text}');

// Returns {{This is a long text}}.
longText.valueOf();

// Returns {This is a long text}.
longText.textWrap('', '');

// Returns {{This is a long text}.
longText.textWrap('{', '');

// Returns {This is a long text}}.
longText.textWrap('', '}');

// Returns {{This is a long text}}.
longText.textWrap('{', '}');

The opening chars of a generic type variable to wrap the of the instance.

The closing chars of a generic type variable to wrap the of the instance.

The return type is generic type that takes generic type variables , and .

The return value is the wrapped by given and chars of generic type .

text
Wrapper
string
Wrapped
string
Wrapped
opening
closing
opening
return type
closing
return type
text
Wrapper
TextOpening
text
Wrapper
TextClosing
text
Wrapped
opening
closing
Wrapped
TextOpening
TextClosing
Text