@angular-package/wrapper
Version:
Wrap the text with the opening and closing chars.
1 lines • 35.8 kB
Source Map (JSON)
{"version":3,"file":"angular-package-wrapper.mjs","sources":["../../../packages/wrapper/src/lib/wrap.class.ts","../../../packages/wrapper/src/lib/wrapper.class.ts"],"sourcesContent":["/**\n * The `Wrap` object is based on the `String` object and represents the immutable primitive value of the text wrapped by the opening and\n * closing chars. It is designed to preserve the type names of the supplied opening, text, and closing chars by using the generic type\n * variables.\n */\nexport class Wrap<\n Opening extends string = string,\n Text extends string = ``,\n Closing extends string = string\n> extends String {\n //#region instance public accessors.\n /**\n * The `get` accessor gets the closing of the wrap by returning the `#closing` property of a specified object.\n * @returns The return value is closing of the wrap of a generic type variable `Closing`.\n * @angularpackage\n */\n public get closing(): Closing {\n return this.#closing;\n }\n\n /**\n * The `get` accessor gets the opening of the wrap by returning the `#opening` property of a specified object.\n * @returns The return value is the opening of the wrap of a generic type variable `Opening`.\n * @angularpackage\n */\n public get opening(): Opening {\n return this.#opening;\n }\n\n /**\n * The `get` accessor gets the text of the `Wrap` by returning the `#text` property of a specified object.\n * @returns The return value is the text of a generic type variable `Text`.\n * @angularpackage\n */\n public get text(): Text {\n return this.#text;\n }\n\n /**\n * The `get` accessor, with the help of `toStringTag`, changes the default tag to `'wrap'` for an instance of `Wrap`. It can be read by\n * the `typeOf()` function of `@angular-package/type`.\n * @returns The return value is the word 'wrap` of a `string`.\n * @angularpackage\n */\n public get [Symbol.toStringTag](): string {\n return 'Wrap';\n }\n //#endregion instance public accessors.\n\n //#region instance private properties.\n /**\n * Private property of the closing chars of a generic type variable `Closing`.\n */\n #closing: Closing;\n\n /**\n * Private property of the opening chars of a generic type variable `Opening`.\n */\n #opening: Opening;\n\n /**\n * Private property of text of a generic type variable `Text`.\n */\n #text: Text;\n //#endregion instance private properties.\n\n //#region static public methods.\n /**\n * The method checks whether the text has given `closing` chars at the end.\n * @param text The text of `string` type, to check whether it contains given `closing` chars.\n * @param closing The closing chars of `string` type to check if a given `text` contains.\n * @returns The return value is a `boolean` indicating whether the `text` contains `closing` chars at the end.\n * @angularpackage\n */\n public static hasClosing(text: string, closing: string): boolean {\n return (\n typeof text === 'string' &&\n text.length >= 1 &&\n typeof closing === 'string' &&\n closing.length >= 1 &&\n text.slice(-closing.length) === closing\n );\n }\n\n /**\n * Checks whether the text has `opening` chars at the beginning.\n * @param text The text of `string`, to check whether it contains given `opening` chars.\n * @param opening The opening chars of `string` to check if a given `text` contains.\n * @returns The return value is a `boolean` indicating whether the `text` contains `opening` chars at the beginning.\n * @angularpackage\n */\n public static hasOpening(text: string, opening: string): boolean {\n return (\n typeof text === 'string' &&\n text.length >= 1 &&\n typeof opening === 'string' &&\n opening.length >= 1 &&\n text.slice(0, opening.length) === opening\n );\n }\n\n /**\n * The method checks whether the `value` of any type is the `Wrap` instance of any or given `opening` and `closing` chars.\n * @param value The value of any type to test against the `Wrap` instance of any or given opening and closing.\n * @param opening Optional opening chars of a generic type variable `Opening` to check if the given `value` contains.\n * @param closing Optional closing chars of a generic type variable `Closing` to check if the given `value` contains.\n * @param text An optional text of a generic type variable `Text` to check if the given `value` contains.\n * @returns The return value is a `boolean` type indicating whether the value is an instance of `Wrap` of any, or the given opening,\n * closing, and text.\n * @angularpackage\n */\n public static isWrap<\n Opening extends string = string,\n Closing extends string = string,\n Text extends string = ``\n >(\n value: any,\n opening?: Opening,\n closing?: Closing,\n text?: Text\n ): value is Wrap<Opening, Text, Closing> {\n return typeof value === 'object' && value instanceof this\n ? (typeof opening === 'string' ? opening === value.opening : true) &&\n (typeof closing === 'string' ? closing === value.closing : true) &&\n (typeof text === 'string' ? text === value.text : true)\n : false;\n }\n //#endregion static public methods.\n\n //#region constructor.\n /**\n * Creates a new `Wrap` instance of the opening and closing chars and optional text to wrap.\n * @param opening Opening characters of the generic type variable `Opening` placed before the given `text`. An empty `string` indicates\n * that for the `hasOpening()` and `isWrapped()` methods, the opening chars are `undefined`, returning `false`.\n * @param closing Closing characters of the generic type variable `Closing` placed after the given `text`. An empty `string` indicates\n * that for the `hasClosing()` and `isWrapped()` methods, the closing chars are `undefined`, returning `false`.\n * @param text An optional text placed between the given `opening` and `closing` chars on the template `${Opening}${Text}${Closing}`.\n * @angularpackage\n */\n constructor(opening: Opening, closing: Closing, text: Text = '' as Text) {\n super(`${opening}${text}${closing}`);\n this.#closing = String(closing) as Closing;\n this.#text = String(text) as Text;\n this.#opening = String(opening) as Opening;\n }\n //#endregion constructor.\n\n //#region instance public methods.\n /**\n * Gets the closing chars of the wrap by returning the `#closing` property of a specified object.\n * @returns The return value is closing chars of a generic type variable `Closing`.\n * @angularpackage\n */\n public getClosing(): Closing {\n return this.#closing;\n }\n\n /**\n * Gets the opening chars of the wrap by returning the `#opening` property of a specified object.\n * @returns The return value is opening chars of a generic type variable `Opening`.\n * @angularpackage\n */\n public getOpening(): Opening {\n return this.#opening;\n }\n\n /**\n * Gets the text of the wrap by returning the `#text` property of a specified object, without the opening and closing chars of the `Wrap`.\n * @returns The return value is the text of a generic type variable `Text`.\n * @angularpackage\n */\n public getText(): Text {\n return this.#text;\n }\n\n /**\n * Checks whether the primitive value of a specified object has the closing chars or given `closing` chars. If given `closing` chars in\n * the constructor are the empty `string`, the method returns `false`.\n * @param closing Optional closing chars of a `string` type to check whether the primitive value contains them at the **end**.\n * @returns The return value is a `boolean` indicating whether the primitive value has the closing chars or given closing chars.\n * @angularpackage\n */\n public hasClosing(closing?: string): boolean {\n return (\n this.#closing.length >= 1 &&\n (typeof closing === 'string' ? this.#closing === closing : true)\n );\n }\n\n /**\n * Checks whether the primitive value of a specified object has the opening chars or given `opening` chars. If given `opening` chars in\n * the constructor are the empty `string`, the method returns `false`.\n * @param opening Optional opening chars of a `string` type to check if the primitive value contains them at the **beginning**.\n * @returns The return value is a `boolean` indicating whether the primitive value has the opening chars or given `opening` chars.\n * @angularpackage\n */\n public hasOpening(opening?: string): boolean {\n return (\n this.#opening.length >= 1 &&\n (typeof opening === 'string' ? this.#opening === opening : true)\n );\n }\n\n /**\n * The method checks whether the text of a specified `Wrap` object is defined, which means it's a `string` of at least one char and\n * optionally equal to the given `text`.\n * @param text Optional text of `string` type to check whether it's equal to the text of the `Wrap` object.\n * @returns The return value is a `boolean` indicating whether the text is defined and optionally equal to the given text.\n * @angularpackage\n */\n public hasText(text?: string): boolean {\n return (\n this.#text.length >= 1 &&\n (typeof text === 'string' ? this.#text === text : true)\n );\n }\n\n /**\n * The method checks whether the primitive value of the specified `object` is wrapped by the opening and closing chars of an instance or\n * given `opening` and `closing` chars. If given `opening` or `closing` chars in the constructor are the empty `string`, the method\n * returns `false`.\n * @param opening Optional opening chars of a `string` type to check if the primitive value contains them at the beginning. The default\n * value is picked from the private `#opening` property of an instance.\n * @param closing Optional closing chars of a `string` type to check if the primitive value contains them at the end. The default value is\n * picked from the private `#closing` property of an instance.\n * @returns The return value is a `boolean` indicating whether the object has both opening and closing chars or given `opening` and\n * `closing` chars.\n * @angularpackage\n */\n public isWrapped(\n opening: string = this.#opening,\n closing: string = this.#closing\n ): boolean {\n return this.hasOpening(opening) && this.hasClosing(closing);\n }\n\n /**\n * Returns the primitive value with replaced closing chars.\n * @param closing The closing chars of a generic type variable `ReplaceClosing` to replace the closing chars in the primitive value.\n * @returns The return value is the primitive value with replaced closing chars of a generic type variables in order `Opening`, `Text` and\n * `ReplaceClosing` on the template `${Opening}${Text}${ReplaceClosing}`.\n * @angularpackage\n */\n public replaceClosing<ReplaceClosing extends string = ''>(\n closing: ReplaceClosing\n ): `${Opening}${Text}${ReplaceClosing}` {\n return `${this.#opening}${this.#text}${closing}`;\n }\n\n /**\n * Returns the primitive value with replaced opening chars.\n * @param opening The opening chars of a generic type variable `ReplaceOpening` to replace the opening chars in the primitive value.\n * @returns The return value is the primitive value with replaced opening chars of a generic type variables in order `ReplaceOpening`,\n * `Text` and `Closing` on the template `${ReplaceOpening}${Text}${Closing}`.\n * @angularpackage\n */\n public replaceOpening<ReplaceOpening extends string = ''>(\n opening: ReplaceOpening\n ): `${ReplaceOpening}${Text}${Closing}` {\n return `${opening}${this.#text}${this.#closing}`;\n }\n\n /**\n * Returns the primitive value with replaced text.\n * @param text The text of a generic type variable `ReplaceText` to replace the text in the primitive value.\n * @returns The return value is the primitive value with replaced text of a generic type variables in order `Opening`, `ReplaceText`\n * and `Closing` on the template `${Opening}${ReplaceText}${Closing}`.\n * @angularpackage\n */\n public replaceText<ReplaceText extends string = ''>(\n text: ReplaceText\n ): `${Opening}${ReplaceText}${Closing}` {\n return `${this.#opening}${text}${this.#closing}`;\n }\n\n /**\n * Gets the wrap, the primitive value of a specified `Wrap` object.\n * @returns The return value is the wrap of generic type variables in order `Opening`, `Text`, and `Closing` on the template\n * `${Opening}${Text}${Closing}`.\n * @angularpackage\n */\n public toString(): `${Opening}${Text}${Closing}` {\n return super.toString() as `${Opening}${Text}${Closing}`;\n }\n\n /**\n * Returns the wrap, primitive value of a specified `Wrap` object.\n * @returns The return value is the wrap of generic type variables in order `Opening`, `Text`, and `Closing` on the template\n * `${Opening}${Text}${Closing}`.\n * @angularpackage\n */\n public valueOf(): `${Opening}${Text}${Closing}` {\n return super.valueOf() as `${Opening}${Text}${Closing}`;\n }\n //#endregion instance public methods.\n}\n","// Class.\nimport { Wrap } from './wrap.class';\n// Type.\nimport { Wrapped } from '../type/wrapped.type';\n/**\n * The `Wrapper` is an extension of the `Wrap` object, which means it represents the immutable wrap of the opening and closing with the\n * additional ability to use it to wrap strings.\n */\nexport class Wrapper<\n Opening extends string = string,\n Text extends string = '',\n Closing extends string = string\n> extends Wrap<Opening, Text, Closing> {\n //#region instance accessors.\n /**\n * The property, with the help of `toStringTag`, changes the default tag to `'wrapper'` in the `Wrapper` instance. It can be read by the\n * `typeOf()` function of `@angular-package/type`.\n */\n public get [Symbol.toStringTag](): string {\n return 'Wrapper';\n }\n //#endregion instance accessors.\n\n //#region static public methods.\n /**\n * Defines a new `Wrapper` instance with the provided `opening`, `closing` chars, and optional `text`.\n * @param opening The opening chars of generic type variable `Opening` for new `Wrapper` instance.\n * @param closing The closing chars of generic type variable `Closing` for new `Wrapper` instance.\n * @param text An optional text of generic type variable `Text` for new `Wrapper` instance.\n * @returns The return value is the `Wrapper` instance of given `opening`, `closing` chars, and optional `text`.\n * @angularpackage\n */\n public static define<\n Opening extends string,\n Closing extends string,\n Text extends string = ''\n >(\n opening: Opening,\n closing: Closing,\n text?: Text\n ): Wrapper<Opening, Text, Closing> {\n return new this(opening, closing, text);\n }\n\n /**\n * The method checks if the value of any type is an instance of the `Wrapper` of any, or the given `opening`, `closing` chars, and `text`.\n * @param value The value of any type to test against the `Wrapper` instance.\n * @param opening Optional opening chars of generic type variable `Opening` to check if the given `value` contains.\n * @param closing Optional closing chars of generic type variable `Closing` to check if the given `value` contains.\n * @param text An optional text of generic type variable `Text` to check if the given `value` contains.\n * @returns The return value is a `boolean` type indicating whether the value is an instance of `Wrapper` of any, or the given opening,\n * closing chars, and text.\n * @angularpackage\n */\n public static isWrapper<\n Opening extends string,\n Closing extends string,\n Text extends string = string\n >(\n value: any,\n opening?: Opening,\n closing?: Closing,\n text?: Text\n ): value is Wrapper<Opening, Text, Closing> {\n return (\n typeof value === 'object' &&\n value instanceof this &&\n super.isWrap(value, opening, closing, text)\n );\n }\n\n /**\n * Replaces given `closing` chars with a given replacement value at the end of the given `text`.\n * @param text The text of `string` type in which given `closing` characters are replaced by a given replacement value.\n * @param closing The closing chars of the `string` to replace by a given replacement value at the end of the given `text`.\n * @param replaceValue The replacement value of a string type for the given `closing` characters in the given `text`.\n * @returns The return value is the given `text` of `string` type with a replaced `closing` chars by a given replacement value or the\n * specified `text` unchanged if it does not contain the given `closing` chars.\n * @angularpackage\n */\n public static replaceClosing(\n text: string,\n closing: string,\n replaceValue: string\n ): string {\n return this.hasClosing(text, closing)\n ? text.slice(0, -closing.length) + replaceValue\n : text;\n }\n\n /**\n * Replaces given `opening` chars with a given replacement value at the beginning of the given `text`.\n * @param text The text of `string` type in which the given `opening` chars are replaced by a given replacement value.\n * @param opening The opening chars of the `string` to replace by a given replacement value at the beginning of the given `text`.\n * @param replaceValue The replacement value of a string type for the given `opening` characters in the given `text`.\n * @returns The return value is the given `text` of `string` type with a replaced `opening` chars by a given replacement value or the\n * specified `text` unchanged if it does not contain the given `opening` chars.\n * @angularpackage\n */\n public static replaceOpening(\n text: string,\n opening: string,\n replaceValue: string\n ): string {\n return this.hasOpening(text, opening)\n ? text.replace(opening, String(replaceValue))\n : text;\n }\n\n /**\n * The method returns the given `text` without the given `opening` and `closing` chars.\n * @param text The text of the `string` from which given opening and closing chars are removed.\n * @param opening The opening chars of the `string` to be removed in the given `text`.\n * @param closing The closing chars of the `string` to be removed in the given `text`.\n * @returns The return value is the given `text` of `string` type without the given `opening` and `closing` chars or unchanged `text` if\n * it does not contain the given `opening` and `closing` chars.\n * @angularpackage\n */\n public static unwrap(text: string, opening: string, closing: string): string {\n return (\n (text = this.replaceClosing(text, closing, '')),\n (text = this.replaceOpening(text, opening, '')),\n text\n );\n }\n //#endregion static public methods.\n\n //#region constructor.\n /**\n * Creates a new `Wrapper` instance with the opening and closing chars and optional text.\n * @param opening The opening chars of a generic type variable `Opening` placed before the given `text`.\n * @param closing The closing chars of a generic type variable `Closing` placed after the given `text`.\n * @param text Optional text of a generic type variable `Text` to wrap by given `opening` and `closing` chars.\n * @returns The return value is a new `Wrapper` instance.\n * @angularpackage\n */\n constructor(opening: Opening, closing: Closing, text: Text = '' as Text) {\n super(opening, closing, text);\n }\n //#endregion constructor.\n\n //#region instance public methods.\n /**\n * Determines whether the provided `text` has the closing chars of the specified `Wrapper` object at the end.\n * @param text The text of `string` to test for the existence of the closing chars at the end of it.\n * @returns The return value is a `boolean` indicating whether the given `text` has the closing chars of the wrap.\n * @angularpackage\n */\n public isClosingIn(text: string): boolean {\n return Wrapper.hasClosing(text, this.closing);\n }\n\n /**\n * Checks whether the provided `text` has the opening chars of a specified `Wrapper` object at the beginning.\n * @param text The text of `string` to test for the existence of the opening chars at the beginning of it.\n * @returns The return value is a `boolean` indicating whether the given `text` has the opening chars of the wrap.\n * @angularpackage\n */\n public isOpeningIn(text: string): boolean {\n return Wrapper.hasOpening(text, this.opening);\n }\n\n /**\n * Replaces the closing chars of the `Wrapper` object in the given `text` with a given replacement value.\n * The replacement succeeds if the closing characters exist at the end of the text.\n * @param text The text of `string` type in which the closing chars are replaced by given replacement value.\n * @param replaceValue The value of `string` type as a replacement for the closing chars at the end of the given `text`.\n * @returns The return value is the given `text` of `string` type with replaced closing chars by given replacement value.\n * @angularpackage\n */\n public replaceClosingIn(text: string, replaceValue: string): string {\n return Wrapper.replaceClosing(text, this.closing, replaceValue);\n }\n\n /**\n * Replaces the opening chars of the `Wrapper` object in the given `text` with a given replacement value.\n * The replacement succeeds if the opening characters exist at the beginning of the text.\n * @param text The text of `string` type in which the opening chars are replaced by given replacement value.\n * @param replaceValue The value of `string` type as a replacement for the opening chars at the beginning of the given `text`.\n * @returns The return value is the given `text` of `string` type with replaced opening chars by given replacement value.\n * @angularpackage\n */\n public replaceOpeningIn(text: string, replaceValue: string): string {\n return Wrapper.replaceOpening(text, this.opening, replaceValue);\n }\n\n /**\n * Returns given `text` without the opening and closing chars of the `Wrapper` object.\n * @param text The text of a `string` type to unwrap from the opening and closing chars of the `Wrapper` object.\n * @returns The return value is the text of `string` type unwrapped from the opening and closing chars of the `Wrapper` object.\n * @angularpackage\n */\n public removeWrapIn(text: string): string {\n return (\n (text = this.replaceClosingIn(text, '')),\n (text = this.replaceOpeningIn(text, '')),\n text\n );\n }\n\n /**\n * Replaces the closing chars of the `Wrapper` object in the text of the `Wrapper` object with the given `closing` chars.\n * The replacement succeeds if the closing characters exist at the end of the text.\n * @param closing The closing chars of `string` to replace in the text(part of the primitive value).\n * @returns The return value is the text of `string` type with replaced closing chars.\n * @angularpackage\n */\n public textReplaceClosing(closing: string): string {\n return Wrapper.replaceClosing(this.text, this.closing, closing);\n }\n\n /**\n * Replaces the opening chars of the `Wrapper` object in the text of the `Wrapper` object with the given `opening` chars. The replacement\n * succeeds if the opening characters exist at the beginning of the text.\n * @param opening The opening chars of `string` to replace in the text(part of the primitive value).\n * @returns The return value is the text of `string` type with replaced opening chars.\n * @angularpackage\n */\n public textReplaceOpening(opening: string): string {\n return Wrapper.replaceOpening(this.text, this.opening, opening);\n }\n\n /**\n * The method returns the text of the `Wrapper` object without its opening and closing chars or the given `opening` and `closing` chars.\n * @param opening Optional opening chars of `string` type to remove from the beginning of the text of the `Wrapper` instance. By default,\n * its value is equal to the opening chars of the `Wrapper` instance.\n * @param closing Optional closing chars of `string` type to remove from the end of the text of the `Wrapper` instance. By default, its\n * value is equal to the closing chars of the `Wrapper` instance.\n * @returns The return value is the text of `string` type without the opening and closing chars of the `Wrapper` object or given `opening`\n * and `closing` chars.\n * @angularpackage\n */\n public textUnwrap(\n opening: string = this.opening,\n closing: string = this.closing\n ): string {\n return Wrapper.unwrap(this.text, opening, closing);\n }\n\n /**\n * The method returns the text of the `Wrapper` object wrapped by the given `opening` and `closing` chars.\n * @param opening The opening chars of a generic type variable `TextOpening` to wrap the text of the `Wrapper` instance.\n * @param closing The closing chars of a generic type variable `TextClosing` to wrap the text of the `Wrapper` instance.\n * @returns The return value is the text wrapped by given `opening` and closing `chars` of generic type `Wrapped`.\n * @angularpackage\n */\n public textWrap<TextOpening extends string, TextClosing extends string>(\n opening: TextOpening,\n closing: TextClosing\n ): Wrapped<TextOpening, Text, TextClosing> {\n return new Wrap(opening, closing, this.text).valueOf();\n }\n\n /**\n * Returns an `array` consisting of the opening chars, text, and closing chars.\n * @returns The return value is a read-only `array` consisting of the opening chars, text, and closing chars.\n * @angularpackage\n */\n public toArray(): readonly [Opening, Text, Closing] {\n return [this.opening, this.text, this.closing];\n }\n\n /**\n * Returns the `Wrap` instance consists of the text, opening and closing chars of the `Wrapper` object.\n * @returns The return value is an instance of `Wrap` consisting of the text, opening, and closing chars of the `Wrapper` object.\n * @angularpackage\n */\n public toWrap(): Wrap<Opening, Text, Closing> {\n return new Wrap(this.opening, this.closing, this.text);\n }\n\n /**\n * Returns the text without the opening and closing chars.\n * @returns The return value is the text of a generic type variable `Text`.\n * @angularpackage\n */\n public unwrap(): Text {\n return this.text;\n }\n\n /**\n * The method returns the primitive value of a specified `Wrapper` object with text unwrapped from the opening and closing chars of the\n * `Wrapper` instance or given `opening` and `closing` chars.\n * @param opening Optional opening chars of `string` type to remove from the beginning of the text of the `Wrapper` instance. By default,\n * its value is equal to the opening chars of the `Wrapper` instance.\n * @param closing Optional closing chars of `string` type to remove from the end of the text of the `Wrapper` instance. By default, its\n * value is equal to the closing chars of the `Wrapper` instance.\n * @returns The return value is the primitive value of `string` type with text unwrapped from the opening and closing chars of the\n * `Wrapper` object or the given `opening` and `closing` chars.\n * @angularpackage\n */\n public unwrapText(\n opening: string = this.opening,\n closing: string = this.closing\n ): string {\n return `${this.opening}${Wrapper.unwrap(this.text, opening, closing)}${\n this.closing\n }`;\n }\n\n /**\n * The method wraps the primitive value of a specified `Wrapper` object by its opening and closing chars or given `opening` and `closing`\n * chars.\n * @param opening Optional opening chars of a generic type variable `CustomOpening` to wrap the primitive value of the `Wrapper` instance.\n * By default, its value is equal to the opening chars of the `Wrapper` instance.\n * @param closing Optional closing chars of a generic type variable `CustomClosing` to wrap the primitive value of the `Wrapper` instance.\n * By default, its value is equal to the closing chars of the `Wrapper` instance.\n * @returns The return value is a primitive value wrapped by the opening and closing chars of the `Wrapper` instance or the given\n * `opening` and `closing` chars.\n * @angularpackage\n */\n public wrap<\n CustomOpening extends string = Opening,\n CustomClosing extends string = Closing\n >(\n opening: CustomOpening = this.opening as any,\n closing: CustomClosing = this.closing as any\n ): Wrapped<CustomOpening, Wrapped<Opening, Text, Closing>, CustomClosing> {\n return new Wrap(opening, closing, this.valueOf()).valueOf();\n }\n\n /**\n * The method wraps the given `text` with the wrap, the `opening`, and `closing` chars of the `Wrapper` object.\n * @param text The text of generic type variable `CustomText` to wrap by the opening and closing chars of the `Wrapper` instance.\n * @returns The return value is the given `text` wrapped by the opening and closing chars of the `Wrapper` object of the generic type\n * `Wrapped`.\n * @angularpackage\n */\n public wrapOn<CustomText extends string = ''>(\n text: CustomText\n ): Wrapped<Opening, CustomText, Closing> {\n return new Wrap(this.opening, this.closing, text).valueOf();\n }\n\n /**\n * The method returns the primitive value of the `Wrapper` object with text wrapped by given `opening` and `closing` chars.\n * @param opening The opening chars of a generic type variable `TextOpening` to wrap the text of the `Wrapper` instance.\n * @param closing The closing chars of a generic type variable `TextClosing` to wrap the text of the `Wrapper` instance.\n * @returns The return value is the primitive value with wrapped text by given opening and closing characters of generic type `Wrapped`.\n * @angularpackage\n */\n public wrapText<\n TextOpening extends string = '',\n TextClosing extends string = ''\n >(\n opening: TextOpening,\n closing: TextClosing\n ): Wrapped<Opening, Wrapped<TextOpening, Text, TextClosing>, Closing> {\n return `${this.opening}${this.textWrap(opening, closing)}${this.closing}`;\n }\n //#endregion instance public methods.\n}\n"],"names":[],"mappings":";;;MAKa,IAIX,SAAQ,MAAM;IAkId,YAAY,OAAgB,EAAE,OAAgB,EAAE,OAAa,EAAU;QACrE,KAAK,CAAC,GAAG,OAAO,GAAG,IAAI,GAAG,OAAO,EAAE,CAAC,CAAC;QAvFvC,gCAAkB;QAKlB,gCAAkB;QAKjB,6BAAY;QA8EX,uBAAA,IAAI,iBAAY,MAAM,CAAC,OAAO,CAAY,MAAA,CAAC;QAC3C,uBAAA,IAAI,cAAS,MAAM,CAAC,IAAI,CAAS,MAAA,CAAC;QAClC,uBAAA,IAAI,iBAAY,MAAM,CAAC,OAAO,CAAY,MAAA,CAAC;KAC5C;IAhID,IAAW,OAAO;QAChB,OAAO,uBAAA,IAAI,qBAAS,CAAC;KACtB;IAOD,IAAW,OAAO;QAChB,OAAO,uBAAA,IAAI,qBAAS,CAAC;KACtB;IAOD,IAAW,IAAI;QACb,OAAO,uBAAA,IAAI,kBAAM,CAAC;KACnB;IAQD,gGAAY,MAAM,CAAC,WAAW,EAAC;QAC7B,OAAO,MAAM,CAAC;KACf;IA4BM,OAAO,UAAU,CAAC,IAAY,E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