public static hasClosing(text: string, closing: string): boolean {
return (
typeof text === 'string' &&
text.length >= 1 &&
typeof closing === 'string' &&
closing.length >= 1 &&
text.slice(-closing.length) === closing
);
}
// Example usage.
import { Wrap } from '@angular-package/wrapper';
const quote = new Wrap(`[`, `]`, 'quote');
// Returns true.
Wrap.hasClosing(quote.valueOf(), ']');
// Returns false.
Wrap.hasClosing(quote.valueOf(), '>');
// Returns false.
Wrap.hasClosing(quote.valueOf(), '');
// Returns false.
Wrap.hasClosing(new Wrap(`[`, ``, 'quote').valueOf(), '');