hasOpening()

Wrap.prototype.hasOpening()

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

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

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

Parameters

opening?: string

Optional opening chars of a string type to check if the primitive value contains them at the beginning.

Returns

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

Example usage

Given closing chars

Last updated

Was this helpful?