DieselDepot-APP/node_modules/es-toolkit/dist/fp/array/at.js
SJCoetz def597c157 chore: add generated build artifacts and node module type files
add all Next.js build outputs and third-party dependency type declaration files
2026-07-20 01:18:42 +02:00

25 lines
786 B
JavaScript

const require_at = require("../../array/at.js");
//#region src/fp/array/at.ts
/**
* Creates a function that retrieves elements from the piped array at the specified indices.
*
* Negative indices count back from the end of the array, matching the main {@link at}
* implementation. Use the returned function with {@link pipe}.
*
* @template T - The type of elements in the array.
* @param indices - The indices of the elements to retrieve from the piped array.
* @returns A function that maps a readonly array to a new array of selected values.
*
* @example
* import { at, pipe } from 'es-toolkit/fp';
*
* pipe([10, 20, 30, 40], at([1, -1]));
* // => [20, 40]
*/
function at(indices) {
return function(array) {
return require_at.at(array, indices);
};
}
//#endregion
exports.at = at;