@typescript-package/wrapper
Version:
A lightweight TypeScript library to wrap the text with the opening and closing chars.
1 lines • 37.3 kB
Source Map (JSON)
{"version":3,"file":"typescript-package-wrapper.mjs","sources":["../../../package/wrapper/src/lib/wrap.class.ts","../../../package/wrapper/src/lib/wrapper.class.ts","../../../package/wrapper/src/public-api.ts","../../../package/wrapper/src/typescript-package-wrapper.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 */\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 */\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 */\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 `@typescript-package/type`.\n * @returns The return value is the word 'Wrap` of a `string`.\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 */\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 */\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 */\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 */\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 */\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 */\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 */\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 */\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 */\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 */\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 */\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 */\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 */\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 */\n public replaceText<ReplaceText extends string = ''>(\n text: ReplaceText\n ): `${Opening}${ReplaceText}${Closing}` {\n return `${this.#opening}${text}${this.#closing}`;\n }\n\n /**\n * Checks whether the wrapped text starts with the specified opening characters.\n * @param opening Optional opening characters to check against. Defaults to the instance's `#opening`.\n * @returns The returned value is a `boolean` indicating whether the wrapped text starts with the given or default opening characters.\n */\n public override startsWith(opening: string = this.#opening): boolean {\n return this.toString().startsWith(opening);\n }\n\n /**\n * Checks whether the wrapped text ends with the specified closing characters.\n * @param closing Optional closing characters to check against. Defaults to the instance's `#closing`.\n * @returns The returned value is a `boolean` indicating whether the wrapped text ends with the given or default closing characters.\n */\n public override endsWith(closing: string = this.#closing): boolean {\n return this.toString().endsWith(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 */\n public override 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 */\n public override 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 override 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 */\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 */\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 replacement 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 */\n public static replaceClosing(\n text: string,\n closing: string,\n replacement: string\n ): string {\n return this.hasClosing(text, closing)\n ? text.slice(0, -closing.length) + replacement\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 replacement 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 */\n public static replaceOpening(\n text: string,\n opening: string,\n replacement: string\n ): string {\n return this.hasOpening(text, opening)\n ? text.replace(opening, String(replacement))\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 */\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 */\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 */\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 */\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 */\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 */\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 */\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 * 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 */\n public rewrap<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 * 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 */\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 */\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 */\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 * 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 */\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 */\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 */\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 */\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 */\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 */\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 */\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.rewrap(opening, closing)}${this.closing}`;\n }\n //#endregion instance public methods.\n}\n","/*\n * Public API Surface of wrapper\n */\n\nexport {\n // Object.\n Wrap,\n Wrapper,\n} from './lib';\n\nexport type { Wrapped } from './type/wrapped.type';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":"AAAA;;;;AAIG;AACG,MAAO,IAIX,SAAQ,MAAM,CAAA;;AAEd;;;AAGG;AACH,IAAA,IAAW,OAAO,GAAA;QAChB,OAAO,IAAI,CAAC,QAAQ;;AAGtB;;;AAGG;AACH,IAAA,IAAW,OAAO,GAAA;QAChB,OAAO,IAAI,CAAC,QAAQ;;AAGtB;;;AAGG;AACH,IAAA,IAAW,IAAI,GAAA;QACb,OAAO,IAAI,CAAC,KAAK;;AAGnB;;;;AAIG;AACH,IAAA,KAAY,MAAM,CAAC,WAAW,CAAC,GAAA;AAC7B,QAAA,OAAO,MAAM;;;;AAKf;;AAEG;AACH,IAAA,QAAQ;AAER;;AAEG;AACH,IAAA,QAAQ;AAER;;AAEG;AACF,IAAA,KAAK;;;AAIN;;;;;AAKG;AACI,IAAA,OAAO,UAAU,CAAC,IAAY,EAAE,OAAe,EAAA;AACpD,QAAA,QACE,OAAO,IAAI,KAAK,QA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