★ replaceClosing()
Wrap.prototype.replaceClosing()
Wrap.prototype.replaceClosing()Returns the primitive value with replaced closing chars.
public replaceClosing<ReplaceClosing extends string = ''>(
closing: ReplaceClosing
): `${Opening}${Text}${ReplaceClosing}` {
return `${this.#opening}${this.#text}${String(closing) as ReplaceClosing}`;
}Generic type variables
ReplaceClosingextendsstring=''
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
closing: replaceClosingThe closing chars of a generic type variable ReplaceClosing to replace the closing chars in the primitive value.
Return type
${Opening}${Text}${ReplaceClosing}
${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
Was this helpful?