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