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