@yesstudio/yes-utils
    Preparing search index...

    Function toArray

    • Converts a value to an array. If the input is already an array, it returns the input as is. Otherwise, it creates a new array containing the input as its single element.

      Type Parameters

      • T

      Parameters

      • value: T

        The value to convert to an array.

      Returns T extends unknown[] ? T<T> : [T]

      Returns an array containing the input value or the input value itself if it's already an array.

      isArray('Hello, world!')
      // => ['Hello, world!']

      isArray([1, 2, 3])
      // => [1, 2, 3]