@untemps/utils - v3.1.0
    Preparing search index...

    Function extractByIndices

    • Type Parameters

      • T

      Parameters

      • Optionalsource: T[]

        The source array from which extract the values.

      • Optionalindices: number[]

        An array of indices.

      Returns T[]

      A new array containing the values at the specified indices only.

      import { extractByIndices } from '@untemps/utils/array/extractByIndices'

      const source = ['foo', 'bar', 'gag', 'pol', 'zux']
      const indices = [1, 3]
      extractByIndices(source, indices) // ['bar', 'pol']