Options
All
  • Public
  • Public/Protected
  • All
Menu

Module "ensure-array"

Index

Functions

Const ensureArray

  • ensureArray(x: any): any[]
  • Helper function to avoid unnecessary copying if x is already an array.

    remarks

    First checks if x is an array and if so returns it. Else attempts to obtain an iterator from x and if successful collects it as array and returns it. Throws error if x isn't iterable.

    Parameters

    • x: any

      -

    Returns any[]

Const ensureArrayLike

  • ensureArrayLike(x: any): ArrayLike<any>

Generated using TypeDoc