Options
All
  • Public
  • Public/Protected
  • All
Menu

External module "arrayize"

Index

Functions

Functions

arrayize

  • arrayize<T>(value: T | T[]): T[]
  • Encapsulates a non array value with an array that contains it unless the value is already an array


    Example usage:

    import { arrayize } from "@thalesrc/js-utils";
    
    const foo = 'foo';
    const bar = ['bar'];
    const fooArr = arrayize(foo); // ['foo'];
    const barArr = arrayize(bar); // ['bar'];

    Type parameters

    • T

    Parameters

    • value: T | T[]

      Array or single value to capsulate

    Returns T[]

Generated using TypeDoc