# utils/toarray

module

<a id="type-definitions"></a>

## Type Definitions

<a id="typedef-ArrayOrItem"></a>

### `ArrayOrItem`

<a id="typedef-ReadonlyArrayOrItem"></a>

### `ReadonlyArrayOrItem`

<a id="functions"></a>

## Functions

<a id="function-toArray:MUTABLE"></a>

### `toArray( data ) → Array<T>`

Transforms any value to an array. If the provided value is already an array, it is returned unchanged.

[See source](https://github.com/ckeditor/ckeditor5/blob/master/packages/ckeditor5-utils/src/toarray.ts#L17)

#### Type parameters

* `T`

#### Parameters

* `data: ArrayOrItem<T>`

  The value to transform to an array.

#### Returns

* `Array<T>`

  An array created from data.

<a id="function-toArray:IMMUTABLE"></a>

### `toArray( data ) → readonly Array<T>`

Transforms any value to an array. If the provided value is already an array, it is returned unchanged.

[See source](https://github.com/ckeditor/ckeditor5/blob/master/packages/ckeditor5-utils/src/toarray.ts#L26)

#### Type parameters

* `T`

#### Parameters

* `data: ReadonlyArrayOrItem<T>`

  The value to transform to an array.

#### Returns

* `readonly Array<T>`

  An array created from data.

---

Full index of the CKEditor 5 API reference: [llms.txt](llms.txt)
