isOpeningIn()

Wrapper.prototype.isOpeningIn()

Checks whether the provided text has the opening chars of a specified Wrapper object at the beginning.

wrapper.class.ts
public isOpeningIn(text: string): boolean {
  return Wrapper.hasOpening(text, this.opening);
}

Parameters

text: string

The text of string to test for the existence of the opening chars at the beginning of it.

Returns

The return value is a boolean indicating whether the given text has the opening chars of the wrap.

Example usage

// Example usage.
import { Wrapper } from '@angular-package/wrapper';

const longText = new Wrapper('{{', '}}', 'This is a long text');
const text = `Lorem ipsum and more`;

// Returns false.
longText.isOpeningIn(`${text}${longText.opening}`);

// Returns false.
longText.isOpeningIn(text);

// Returns true.
longText.isOpeningIn(`${longText.opening}${text}`);

Last updated