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

Was this helpful?

  1. Wrapper {}
  2. Methods
  3. Static

define()

PreviousStaticNextisWrapper()

Last updated 3 years ago

Was this helpful?

Wrapper.define()

Defines a new instance with the provided , chars, and optional .

wrapper.class.ts
public static define<
  Opening extends string,
  Closing extends string,
  Text extends string = ''
>(
  opening: Opening,
  closing: Closing,
  text?: Text
): Wrapper<Opening, Text, Closing> {
  return new this(opening, closing, text);
}

Generic type variables

Openingextendsstring

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

Closingextendsstring

Textextendsstring=''

Parameters

opening: Opening

closing: Closing

text?: Text

Return type

Wrapper<Opening, Text, Closing>

Returns

Example usage

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

// Returns Wrapper {'()'}
// of type Wrapper<"(", "", ")">
Wrapper.define('(', ')');

// Returns Wrapper {'!!'}
// of type Wrapper<"!", "", "!">
Wrapper.define('!', '!');

// Returns Wrapper {'"This is quoted text"'}
// of type Wrapper<"\"", "This is quoted text", "\"">
Wrapper.define('"', '"', 'This is quoted text');

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

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

The opening chars of generic type variable for new instance.

The closing chars of generic type variable for new instance.

An optional text of generic type variable for new instance.

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

The return value is the instance of given , chars, and optional .

Wrapper
string
Wrapper
opening
closing
text
opening
return type
string
Wrapper
closing
return type
string
Wrapper
text
return type
Wrapper
Opening
Wrapper
Closing
Wrapper
Text
Wrapper
Opening
Text
Closing
Wrapper
opening
closing
text