@@ -187,6 +187,19 @@ export class Wrapper<
187
187
) ;
188
188
}
189
189
190
+ /**
191
+ * The method returns the text of the `Wrapper` object wrapped by the given `opening` and `closing` chars.
192
+ * @param opening The opening chars of a generic type variable `TextOpening` to wrap the text of the `Wrapper` instance.
193
+ * @param closing The closing chars of a generic type variable `TextClosing` to wrap the text of the `Wrapper` instance.
194
+ * @returns The return value is the text wrapped by given `opening` and closing `chars` of generic type `Wrapped`.
195
+ */
196
+ public rewrap < TextOpening extends string , TextClosing extends string > (
197
+ opening : TextOpening ,
198
+ closing : TextClosing
199
+ ) : Wrapped < TextOpening , Text , TextClosing > {
200
+ return new Wrap ( opening , closing , this . text ) . valueOf ( ) ;
201
+ }
202
+
190
203
/**
191
204
* Replaces the closing chars of the `Wrapper` object in the text of the `Wrapper` object with the given `closing` chars.
192
205
* The replacement succeeds if the closing characters exist at the end of the text.
@@ -223,19 +236,6 @@ export class Wrapper<
223
236
return Wrapper . unwrap ( this . text , opening , closing ) ;
224
237
}
225
238
226
- /**
227
- * The method returns the text of the `Wrapper` object wrapped by the given `opening` and `closing` chars.
228
- * @param opening The opening chars of a generic type variable `TextOpening` to wrap the text of the `Wrapper` instance.
229
- * @param closing The closing chars of a generic type variable `TextClosing` to wrap the text of the `Wrapper` instance.
230
- * @returns The return value is the text wrapped by given `opening` and closing `chars` of generic type `Wrapped`.
231
- */
232
- public textWrap < TextOpening extends string , TextClosing extends string > (
233
- opening : TextOpening ,
234
- closing : TextClosing
235
- ) : Wrapped < TextOpening , Text , TextClosing > {
236
- return new Wrap ( opening , closing , this . text ) . valueOf ( ) ;
237
- }
238
-
239
239
/**
240
240
* Returns an `array` consisting of the opening chars, text, and closing chars.
241
241
* @returns The return value is a read-only `array` consisting of the opening chars, text, and closing chars.
@@ -324,7 +324,7 @@ export class Wrapper<
324
324
opening : TextOpening ,
325
325
closing : TextClosing
326
326
) : Wrapped < Opening , Wrapped < TextOpening , Text , TextClosing > , Closing > {
327
- return `${ this . opening } ${ this . textWrap ( opening , closing ) } ${ this . closing } ` ;
327
+ return `${ this . opening } ${ this . rewrap ( opening , closing ) } ${ this . closing } ` ;
328
328
}
329
329
//#endregion instance public methods.
330
330
}
0 commit comments