Skip to content

Commit 44bd1f5

Browse files
refactor(Wrap): change the parameters default values of isWrapped() instance method to private #opening and #closing and update jsdoc.
1 parent 579ef52 commit 44bd1f5

File tree

1 file changed

+17
-12
lines changed

1 file changed

+17
-12
lines changed

src/lib/wrap.class.ts

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -130,8 +130,10 @@ export class Wrap<
130130
//#region constructor.
131131
/**
132132
* Creates a new `Wrap` instance of the opening and closing chars and optional text to wrap.
133-
* @param opening Opening characters of the generic type variable `Opening` placed before the given `text`.
134-
* @param closing Closing characters of the generic type variable `Closing` placed after the given `text`.
133+
* @param opening Opening characters of the generic type variable `Opening` placed before the given `text`. An empty `string` indicates
134+
* that for the `hasOpening()` and `isWrapped()` methods, the opening chars are `undefined`, returning `false`.
135+
* @param closing Closing characters of the generic type variable `Closing` placed after the given `text`. An empty `string` indicates
136+
* that for the `hasClosing()` and `isWrapped()` methods, the closing chars are `undefined`, returning `false`.
135137
* @param text An optional text placed between the given `opening` and `closing` chars on the template `${Opening}${Text}${Closing}`.
136138
* @angularpackage
137139
*/
@@ -172,8 +174,8 @@ export class Wrap<
172174
}
173175

174176
/**
175-
* Checks whether the primitive value of a specified object has the closing chars or given closing chars. An empty `string` indicates
176-
* `undefined`.
177+
* Checks whether the primitive value of a specified object has the closing chars or given closing chars. If given closing chars in the
178+
* constructor are the empty `string`, the method returns `false`.
177179
* @param closing Optional closing chars of a `string` type to check whether the primitive value contains them at the **end**.
178180
* @returns The return value is a `boolean` indicating whether the primitive value has the closing chars or given closing chars.
179181
* @angularpackage
@@ -186,8 +188,8 @@ export class Wrap<
186188
}
187189

188190
/**
189-
* Checks whether the primitive value of a specified object has the opening chars or given opening chars. An empty `string` indicates
190-
* `undefined`.
191+
* Checks whether the primitive value of a specified object has the opening chars or given opening chars. If given opening chars in the
192+
* constructor are the empty `string`, the method returns `false`.
191193
* @param opening Optional opening chars of a `string` type to check if the primitive value contains them at the **beginning**.
192194
* @returns The return value is a `boolean` indicating whether the primitive value has the opening chars or given `opening` chars.
193195
* @angularpackage
@@ -214,17 +216,20 @@ export class Wrap<
214216
}
215217

216218
/**
217-
* The method checks whether the primitive value of the specified object is wrapped by the opening and closing chars of an instance or
218-
* given `opening` and `closing` chars.
219-
* @param opening Optional opening chars of a `string` type to check if the primitive value contains them at the beginning.
220-
* @param closing Optional closing chars of a `string` type to check if the primitive value contains them at the end.
219+
* The method checks whether the primitive value of the specified `object` is wrapped by the opening and closing chars of an instance or
220+
* given `opening` and `closing` chars. If given opening or closing chars in the constructor are the empty `string`, the method returns
221+
* `false`.
222+
* @param opening Optional opening chars of a `string` type to check if the primitive value contains them at the beginning. The default
223+
* value is picked from the private `#opening` property of an instance.
224+
* @param closing Optional closing chars of a `string` type to check if the primitive value contains them at the end. The default value is
225+
* picked from the private `#closing` property of an instance.
221226
* @returns The return value is a `boolean` indicating whether the object has both opening and closing chars or given `opening` and
222227
* `closing` chars.
223228
* @angularpackage
224229
*/
225230
public isWrapped(
226-
opening: string = this.opening,
227-
closing: string = this.closing
231+
opening: string = this.#opening,
232+
closing: string = this.#closing
228233
): boolean {
229234
return this.hasOpening(opening) && this.hasClosing(closing);
230235
}

0 commit comments

Comments
 (0)