hasClosing()

Wrap.prototype.hasClosing()

Checks whether the primitive value of a specified object has the closing chars or given closing chars.

If given closing chars in the constructor are the empty string, the method returns false.

wrap.class.ts
public hasClosing(closing?: string): boolean {
  return (
    this.#closing.length >= 1 &&
    (typeof closing === 'string' ? this.#closing === closing : true)
  );
}

Parameters

closing?: string

Optional closing chars of a string type to check whether the primitive value contains them at the end.

Returns

The return value is a boolean indicating whether the primitive value has the closing chars or given closing chars.

Example usage

Given closing chars

Last updated

Was this helpful?