UNPKG

ramda-extension

Version:

Helpful functions built on top of the mighty Ramda

29 lines (26 loc) 732 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.default = void 0; var _ramda = require("ramda"); /** * Map using function that is provided with each value of the list and its index in the list. * * @func * @category Object * * @param {Function} fn The function to be called on every element of the `list` and its index. * @param {Array} list The list to be iterated over. * @return {Array} The new list. * * @example * * R_.mapIndexed((value, index) => `${value}-${index}`)([1, 2, 3]) * // ['1-0', '2-1', '3-2'] * * @sig (a -> Number -> a) -> [a] -> a */ var mapIndexed = (0, _ramda.addIndex)(_ramda.map); var _default = mapIndexed; exports.default = _default;