Wrapper
PackagesTwitterGitHub
Draft
Draft
  • Introduction
  • ❤ Benefits
    • Explanation
    • Designing
  • General concepts
  • Getting started
    • Skeleton
    • Installation
      • npm
    • Public API
    • Basic concepts
  • Wrap {}
    • Overview
    • Generic type variables
    • ★ Constructor
    • Accessors
      • get closing()
      • get opening()
      • get text()
      • get [Symbol.toStringTag]()
    • Properties
      • #closing
      • #opening
      • #text
    • Methods
      • ↓ Static
      • static hasClosing()
      • static hasOpening()
      • static isWrap()
      • ↓ Instance
      • getClosing()
      • getOpening()
      • getText()
      • hasClosing()
      • hasOpening()
      • hasText()
      • isWrapped()
      • ★ replaceClosing()
      • ★ replaceOpening()
      • ★ replaceText()
      • toString()
      • valueOf()
    • Example usage
  • Wrapper {}
    • Overview
    • Generic type variables
    • Constructor
    • Accessors
      • get [Symbol.toStringTag]()
    • Methods
      • ↓ Static
      • static define()
      • static isWrapper()
      • static replaceClosing()
      • static replaceOpening()
      • static 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
  • Social
    • Gettr
    • Twitter
    • YouTube
  • Contact
    • ⋯ Chat
    • @ Email
    • ✆ Phone
  • Donate
    • ฿ Cryptocurrency
    • $ Fiat
Powered by GitBook
On this page
  • Wrap()
  • Parameters
  • Returns
  • Example usage

Was this helpful?

Edit on GitHub
  1. Wrap {}

★ Constructor

PreviousGeneric type variablesNextAccessors

Last updated 3 years ago

Was this helpful?

Wrap()

Creates a new instance of the and chars and optional to wrap.

wrap.class.ts
constructor(opening: Opening, closing: Closing, text: Text = '' as Text) {
  super(`${opening}${text}${closing}`);
  this.#closing = String(closing) as Closing;
  this.#text = String(text) as Text;
  this.#opening = String(opening) as Opening;
}

Parameters

opening:

Opening characters of the generic type variable placed before the given . An empty indicates that for the and methods, the chars are , returning false.

closing:

Closing characters of the generic type variable placed after the given . An empty indicates that for the and methods, the chars are , returning false.

text:=''

An optional text placed between the given and chars on the ${Opening}${Text}${Closing}.

Returns

Example usage

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

// Returns Wrap{'[]'}
new Wrap('[', ']');

// Returns Wrap{'nullnull'}
new Wrap(null as any, null as any);

The return value is a new instance of with the of the provided , , and the optional .

Wrap
primitive value
opening
closing
text
Wrap
string
isWrapped()
opening
undefined
string
hasClosing()
isWrapped()
closing
undefined
template literal
opening
closing
text
text
text
opening
closing
Opening
Opening
Closing
Closing
Text
hasOpening()