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

Was this helpful?

  1. Wrap {}
  2. Methods
  3. Instance

★ replaceClosing()

PreviousisWrapped()Next★ replaceOpening()

Last updated 3 years ago

Was this helpful?

Wrap.prototype.replaceClosing()

Returns the with replaced chars.

wrap.class.ts
public replaceClosing<ReplaceClosing extends string = ''>(
  closing: ReplaceClosing
): `${Opening}${Text}${ReplaceClosing}` {
  return `${this.#opening}${this.#text}${String(closing) as ReplaceClosing}`;
}

Generic type variables

ReplaceClosingextendsstring=''

A generic type variable constrained by the , by default of the value captured from the provided indicates the ReplaceClosing type on the template of the .

Parameters

closing: replaceClosing

The closing chars of a generic type variable to replace the chars in the .

Return type

${Opening}${Text}${ReplaceClosing}

Returns

Example usage

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

// Returns [quote}} of type "[quote}}".
new Wrap(`[`, `]`, 'quote').replaceClosing('}}');

// Returns [quote}} of "[quote}}".
new Wrap(`[`, ``, 'quote').replaceClosing('}}');

// Returns [quote> of "[quote>".
new Wrap(`[`, ``, 'quote').replaceClosing('>');

The return type is of generic type variables in order , and .

The return value is the with replaced chars of a generic type variables in order , and on the template.

primitive value
closing
string
closing
primitive value
closing
return type
ReplaceClosing
template literal
ReplaceClosing
primitive value
closing
ReplaceClosing
Opening
Text
Opening
Text