[d24f17c] | 1 | "use strict";
|
---|
| 2 |
|
---|
| 3 | exports.__esModule = true;
|
---|
| 4 | exports["default"] = void 0;
|
---|
| 5 | var _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 | */
|
---|
| 28 | var mapIndexed = (0, _ramda.addIndex)(_ramda.map);
|
---|
| 29 | var _default = mapIndexed;
|
---|
| 30 | exports["default"] = _default; |
---|