★ replaceOpening()
Wrap.prototype.replaceOpening()
Wrap.prototype.replaceOpening()
Returns the primitive value with replaced opening
chars.
public replaceOpening<ReplaceOpening extends string = ''>(
opening: ReplaceOpening
): `${ReplaceOpening}${Text}${Closing}` {
return `${opening}${this.#text}${this.#closing}`;
}
Generic type variables
ReplaceOpening
extends
string
=
''
ReplaceOpening
extends
string
=
''
A generic type variable constrained by the string
, by default of the value captured from the provided opening
indicates the ReplaceOpening
type on the template of the return type.
Parameters
opening: ReplaceOpening
opening: ReplaceOpening
The opening chars of a generic type variable ReplaceOpening
to replace the opening
chars in the primitive value.
Return type
${ReplaceOpening}${Text}${Closing}
${ReplaceOpening}${Text}${Closing}
The return type is the template literal of generic type variables in order ReplaceOpening
, Text
and Closing
.
Returns
The return value is the primitive value with replaced opening
chars of a generic type variables in order ReplaceOpening
, Text
and Closing
on the template.
Example usage
// Example usage.
import { Wrap } from '@angular-package/wrapper';
// Returns {{quote] of type "{{quote]".
new Wrap(`[`, `]`, 'quote').replaceOpening('{{');
// Returns {{quote] of "{{quote]".
new Wrap(``, `]`, 'quote').replaceOpening('{{');
// Returns <quote] of "<quote]".
new Wrap(``, `]`, 'quote').replaceOpening('<');
Last updated
Was this helpful?