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

    Function add

    • Returns the array that adds the given element

      Type Parameters

      • E

      Parameters

      • Optionalarray: null | E[]

        the arrays to inspect

      • Optionalelement: null | E

        the element to add

      Returns undefined | null | E[]

      the array that adds the given element

      David Hsing

      add(undefined, 'bar');    // ['bar']
      add(['foo', 'bar'], undefined); // ['foo', 'bar']
      add(['foo', 'bar'], 'world'); // ['foo', 'bar', 'world']