hasOpening()
Wrap.prototype.hasOpening()
Wrap.prototype.hasOpening()Checks whether the primitive value of a specified object has the opening chars or given opening chars.
public hasOpening(opening?: string): boolean {
return (
this.#opening.length >= 1 &&
(typeof opening === 'string' ? this.#opening === opening : true)
);
}Parameters
opening?: string
opening?: stringOptional 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
// Example usage.
import { Wrap } from '@angular-package/wrapper';
// Returns true.
new Wrap(`[`, `]`, 'quote').hasOpening();
// Returns false.
new Wrap(``, `]`, 'quote').hasOpening();Given closing chars
closing chars// Example usage of given opening chars.
import { Wrap } from '@angular-package/wrapper';
// Returns true.
new Wrap(`[`, `]`, 'quote').hasOpening('[');
// Returns false.
new Wrap(`[`, `]`, 'quote').hasOpening('');
// Returns false.
new Wrap(``, `]`, 'quote').hasOpening('');
// Returns false.
new Wrap(``, `]`, 'quote').hasOpening('[');Last updated
Was this helpful?