Skip to main content

Function: listify()

listify<T>(obj): (string | T)[]

Defined in: src/utils/iterables.ts:253

Convert a value to a list intelligently. A string becomes a single-element array; any other iterable is spread; anything else is wrapped.

Mirrors ManimCE listify (equivalent to tuplify, kept for name-parity).

Type Parameters​

T​

T

Parameters​

obj​

string | T | readonly T[]

Returns​

(string | T)[]

Example​

listify("str");  // ["str"]
listify([1, 2]); // [1, 2]
listify(5); // [5]