@unikue/ts-lang-utils
    Preparing search index...

    Function normalize

    • Normalizes a single element or an array of elements into an array. If the input is falsy, returns an empty array.

      Type Parameters

      • E

      Parameters

      • Optionalelement: E | E[] | null

        The element or array to normalize

      Returns E[]

      an array containing the element(s), or an empty array if the input is falsy

      David Hsing

      normalize('foobar');              // ['foobar']
      normalize(['foo', 'bar']); // ['foo', 'bar']
      normalize(undefined); // []
      normalize(null); // []