Optional opening chars of a type to check if the contains them at the beginning. The default value is picked from the private property of an instance.
closing: string = this.#closing
Optional closing chars of a type to check if the contains them at the end. The default value is picked from the private property of an instance.
Returns
Example usage
Basic
// Example usage.
import { Wrap } from '@angular-package/wrapper';
// Returns true. Checks `[]`.
new Wrap(`[`, `]`, 'quote').isWrapped();
// Returns false.
// It's not wrapped cause of opening chars are an empty string.
new Wrap(``, `]`, 'quote').isWrapped();
// Returns false.
// It's not wrapped cause of closing chars are an empty string.
new Wrap(`[`, ``, 'quote').isWrapped();
// Returns false.
new Wrap(``, ``, 'quote').isWrapped();
Given opening
// Example usage.
import { Wrap } from '@angular-package/wrapper';
// Returns true. Checks `[]`.
new Wrap(`[`, `]`, 'quote').isWrapped('[');
// Returns false.
new Wrap(`[`, `]`, 'quote').isWrapped('[', '');
// Returns false. Checks `<]`.
new Wrap(`[`, `]`, 'quote').isWrapped('<');
// Returns false.
// It's not wrapped cause of opening chars are an empty string.
new Wrap(``, `]`, 'quote').isWrapped('<');
// Returns false.
// It's not wrapped cause of closing chars are an empty string.
new Wrap(`[`, ``, 'quote').isWrapped('[');
// Returns false.
// It's not wrapped cause of closing chars are an empty string.
new Wrap(`[`, ``, 'quote').isWrapped('[', ''),
Given closing
// Example usage.
import { Wrap } from '@angular-package/wrapper';
// Returns true. Checks `[]`.
new Wrap(`[`, `]`, 'quote').isWrapped(undefined, ']');
// Returns false. Checks `[>`.
new Wrap(`[`, `]`, 'quote').isWrapped(undefined, '>');
// Returns false.
// It's not wrapped cause of opening chars are an empty string.
new Wrap(``, `]`, 'quote').isWrapped(undefined, ']');
// Returns false.
// It's not wrapped cause of opening chars are an empty string.
new Wrap(``, `]`, 'quote').isWrapped(``, ']');
Given opening and closing chars
// Example usage.
import { Wrap } from '@angular-package/wrapper';
// Returns false.
new Wrap(`[`, `]`, 'quote').isWrapped('[', ']');
// Returns false.
new Wrap(`[`, `]`, 'quote').isWrapped('[', '>');
// Returns false.
new Wrap(`[`, `]`, 'quote').isWrapped('<', ']');
// Returns false.
new Wrap(`[`, `]`, 'quote').isWrapped('<', '>');
// Returns false.
new Wrap(``, ``, 'quote').isWrapped('', '');
The return value is a indicating whether the object has both and chars or given and chars.