@utilify/core
Version:
Modern, strongly typed, and safe utility function library for JavaScript and TypeScript. Includes type checking, manipulation of arrays, objects, strings, dates, colors, numbers, regular expressions, and more. Compatible with Browser, Node.js, Deno, and B
11 lines • 468 B
TypeScript
/**
* Swaps two elements in an array by index.
* @template T
* @param {T[]} array - The array to modify.
* @param {number} fromIndex - The index of the first element.
* @param {number} toIndex - The index of the second element.
* @returns {T[]} The array with swapped elements.
* @throws {TypeError|RangeError} If arguments are invalid.
*/
export default function swap<T>(array: T[], fromIndex: number, toIndex: number): T[];
//# sourceMappingURL=swap.d.ts.map