source: node_modules/ramda-adjunct/lib/mapIndexed.js

main
Last change on this file was d24f17c, checked in by Aleksandar Panovski <apano77@…>, 15 months ago

Initial commit

  • Property mode set to 100644
File size: 1.1 KB
Line 
1"use strict";
2
3exports.__esModule = true;
4exports["default"] = void 0;
5var _ramda = require("ramda");
6/**
7 * {@link http://ramdajs.com/docs/#map|R.map} function that more closely resembles Array.prototype.map.
8 * It takes two new parameters to its callback function: the current index, and the entire list.
9 *
10 * `mapIndexed` implementation is simple : `
11 * const mapIndexed = R.addIndex(R.map);
12 * `
13 * @func mapIndexed
14 * @memberOf RA
15 * @since {@link https://char0n.github.io/ramda-adjunct/2.5.0|v2.5.0}
16 * @category List
17 * @typedef Idx = Number
18 * @sig Functor f => ((a, Idx, f a) => b) => f a -> f b
19 * @param {Function} fn The function to be called on every element of the input `list`
20 * @param {Array} list The list to be iterated over
21 * @return {Array} The new list
22 * @see {@link http://ramdajs.com/docs/#addIndex|R.addIndex}, {@link http://ramdajs.com/docs/#map|R.map}
23 * @example
24 *
25 * RA.mapIndexed((val, idx, list) => idx + '-' + val, ['f', 'o', 'o', 'b', 'a', 'r']);
26 * //=> ['0-f', '1-o', '2-o', '3-b', '4-a', '5-r']
27 */
28var mapIndexed = (0, _ramda.addIndex)(_ramda.map);
29var _default = mapIndexed;
30exports["default"] = _default;
Note: See TracBrowser for help on using the repository browser.