★ replaceText()

Wrap.prototype.replaceText()

Returns the primitive value with replaced text.

wrap.class.ts
public replaceText<ReplaceText extends string = ''>(
  text: ReplaceText
): `${Opening}${ReplaceText}${Closing}` {
  return `${this.#opening}${text}${this.#closing}`;
}

Generic type variables

ReplaceTextextendsstring=''

A generic type variable constrained by the string, by default of the value captured from the provided text indicates the ReplaceText type on the template of the return type.

Parameters

text: ReplaceText

The text of a generic type variable ReplaceText to replace the text in the primitive value.

Return type

${Opening}${ReplaceText}${Closing}

The return type is the template literal of generic type variables in order Opening, ReplaceText and Closing.

Returns

The return value is the primitive value with replaced text of a generic type variables in order Opening, ReplaceText and Closing on the template.

Example usage

Last updated

Was this helpful?