# utils/toarray

module

<a id="type-definitions">

## Type Definitions

<a id="typedef-ArrayOrItem">

### `ArrayOrItem`

<a id="typedef-ReadonlyArrayOrItem">

### `ReadonlyArrayOrItem`

<a id="functions">

## Functions

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

### `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">

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