Wrap() constructor

Wrap()

Creates a new instance of the Wrap with the opening and closing.

wrap.class.ts
constructor(opening: Opening, closing: Closing) {
  super(Wrap.template`${opening}${closing}`);
  this.#closing = closing;
  this.#opening = opening;
}

Parameters

Name: type
Description

opening: Opening

The wrap opening of a generic type variable Opening.

closing: Closing

The wrap closing of a generic type variable Closing.

Returns

The return value is a new instance of Wrap with the primitive value of the provided opening and closing if set properly, otherwise with an empty string.

Usage

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

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

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

Last updated