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

    Function insert

    • Returns the array that contains all the given elements at the index of the source array

      Type Parameters

      • E

      Parameters

      • Optionalarray: null | E[]

        the array to inspect

      • Optionalindex: number

        the index to insert, negative or greater than the length of source array, means at the end of the source array

      • Optionalelements: null | E[]

        the elements to insert

      Returns undefined | null | E[]

      the array that contains all the given elements at the index of the source array

      David Hsing

      insert(['foo', 'bar'], -1, ['hello', 'world']);    // ['foo', 'bar', 'hello', 'world']
      insert(['foo', 'bar'], 0, ['hello', 'world']); // ['hello', 'world', 'foo', 'bar']
      insert(['foo', 'bar'], 1, ['hello', 'world']); // ['foo', 'hello', 'world', 'bar']
      insert(['foo', 'bar'], 9, ['hello', 'world']); // ['foo', 'bar', 'hello', 'world']