> For the complete documentation index, see [llms.txt](https://wrapper.angular-package.dev/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://wrapper.angular-package.dev/wrapper/methods/instance/toarray.md).

# toArray()

## `Wrapper.prototype.toArray()`

Returns an [`array`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array) consisting of the [`opening`](/wrap/accessors/opening.md) chars, [`text`](/wrap/accessors/text.md), and [`closing`](/wrap/accessors/closing.md) 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`](/wrapper/generic-type-variables.md#wrap-opening), [`Text`](https://wrapper.angular-package.dev/wrapper/methods/instance/pages/8pklXCrH2XMJA5SN1dLm#wrapper-less-than...-text-...greater-than) and [`Closing`](/wrapper/generic-type-variables.md#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`](/wrap/accessors/opening.md) chars, [`text`](/wrap/accessors/text.md), and [`closing`](/wrap/accessors/closing.md) 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();
```
