UNPKG

@devlander/utils

Version:

Comprehensive JavaScript and TypeScript utilities for seamless development. Includes object manipulation, data validation, and more.

14 lines (13 loc) 569 B
/** * Selects an element from a list of provided items based on the specified index. * * @template T - The type of items in the list. * @param {number} index - The index of the item to select. * @param {...T[]} items - The list of items from which to select. * @returns {(T | undefined)} - The selected item if the index is valid, otherwise undefined. * * @example * const result = selectFromList(2, "one", "two", "three"); * console.log(result); // Output: "three" */ export declare const selectFromList: <T>(index: number, ...items: T[]) => T | undefined;