# isWrapped()

### `isWrapped(opening, closing)`

The method checks whether the primitive value of the `Wrap` object has an opening and closing chars or the given opening and closing chars. The method parameter's default values are those from constructor initialization and, they are used in performed [`hasOpening()`](/designing/design-processes/wrap/methods/hasopening.md) and `hasClosing()` methods, so It's obvious how it behaves.

If the `text` parameter is an empty `string` following the reasoning of the `hasOpening()` and `hasClosing()`, the method returns `false` in any case.

```typescript
// Examples without the text.
// Return `false` because there is no text to wrap.
new Wrapper('{{{', '}}}').isWrapped();

// Return `false` because there is no text to wrap.
new Wrapper('{{{', '}}}', '').isWrapped());

// Return `false` because there is no text to wrap.
new Wrapper('', '}}}').isWrapped();

// Return `false` because there is no text to wrap.
new Wrapper('{{{', '').isWrapped();

```

Examples with the provided `text`.

```typescript
// Examples with the text.
// Returns `true`.
new Wrapper('{{{', '}}}', 'wrap me').isWrapped();

// Returns `false` because the opening chars is an empty `string`.
new Wrapper('', '}}}', 'wrap me').isWrapped();

// Returns `false` because the closing chars is an empty `string`.
new Wrapper('{{{', '', 'wrap me').isWrapped();

```

Let's provide some parameters to the method. The default value of parameters is assigned from an instance.

```typescript

// Examples with the text.
// Returns `true`.
new Wrapper('{{{', '}}}', 'wrap me').isWrapped('{{{', '}}}');

// Returns `true` because even if the `opening` is undefined, the default
// value of an instance is used.
new Wrapper('{{{', '}}}', 'wrap me').isWrapped(undefined, '}}}');

// Returns `true` because even if the `closing` is undefined, the default
// value of an instance is used.
new Wrapper('{{{', '}}}', 'wrap me').isWrapped('{{{', undefined);

```

The method parameters are different from the `Wrap` instance.

```typescript

// Returns `false` because different wrap.
new Wrapper('{{{', '}}}', 'wrap me').isWrapped('<<<', '>>>');

// Returns `false` because different wrap.
new Wrapper('{{{', '}}}', 'wrap me').isWrapped(undefined, '>>>');

// Returns `false` because different wrap.
new Wrapper('{{{', '}}}', 'wrap me').isWrapped('<<<', undefined);

```

### Conclusion

The method checks whether the `opening`, `closing`, and the `text` of the `Wrap` instance have a **minimum length** of **1**. Returns `true` when equal or above **1**, and `false` when below **1**.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.angular-package.dev/designing/design-processes/wrap/methods/iswrapped.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
