# toArray()

## `Wrapper.prototype.toArray()`

Returns an [`array`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array) consisting of the [`opening`](https://wrapper.angular-package.dev/wrap/accessors/opening) chars, [`text`](https://wrapper.angular-package.dev/wrap/accessors/text), and [`closing`](https://wrapper.angular-package.dev/wrap/accessors/closing) chars.

{% code title="wrapper.class.ts" %}

```typescript
public toArray(): readonly [Opening, Text, Closing] {
  return [this.opening, this.text, this.closing];
}
```

{% endcode %}

### Return type

#### `readonly [`<mark style="color:green;">`Opening`</mark>`,`<mark style="color:green;">`Text`</mark>`,`<mark style="color:green;">`Closing`</mark>`]`

The **return type** is a **read-only** [`array`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array) of generic type variables in order [`Opening`](https://wrapper.angular-package.dev/generic-type-variables#wrap-opening), [`Text`](https://wrapper.angular-package.dev/generic-type-variables#wrapper-less-than...-text-...greater-than) and [`Closing`](https://wrapper.angular-package.dev/generic-type-variables#wrap-closing).

### Returns

The **return value** is a **read-only** [`array`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array) consisting of the [`opening`](https://wrapper.angular-package.dev/wrap/accessors/opening) chars, [`text`](https://wrapper.angular-package.dev/wrap/accessors/text), and [`closing`](https://wrapper.angular-package.dev/wrap/accessors/closing) chars.

## Example usage

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

const longText = new Wrapper('{', '}', '{This is a long text}');

// Returns ['{', '{This is a long text}', '}'].
longText.toArray();
```


---

# 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://wrapper.angular-package.dev/wrapper/methods/instance/toarray.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.
