UNPKG

@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

18 lines 782 B
/** * @callback AdjustCallback * @template T * @param {T} value - The value to adjust. * @returns {T} The adjusted value. */ /** * Applies a function to the element at the specified index of an array and returns a new array. * If the index is negative or out of bounds, it wraps around using modulo. * @template T * @param {T[]} array - The array to adjust. * @param {number} index - The index of the element to adjust. * @param {AdjustCallback} fn - The function to apply to the element. * @returns {T[]} A new array with the adjusted element. * @throws {TypeError} If array is not an array, index is not a number, or fn is not a function. */ export default function adjust<T>(array: T[], index: number, fn: (value: T) => T): T[]; //# sourceMappingURL=adjust.d.ts.map