★ replaceClosing()

Returns the primitive value with replaced closing chars.

Wrap.prototype.replaceClosing()

Returns the primitive value with replaced closing 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 string, by default of the value captured from the provided closing indicates the ReplaceClosing type on the template of the return type.

Parameters

closing: replaceClosing

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

Return type

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

The return type is template literal of generic type variables in order Opening, Text and ReplaceClosing.

Returns

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

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('>');

Last updated