# 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();
```
