source: node_modules/ramda-adjunct/lib/filterIndexed.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/#filter|R.filter} function that more closely resembles `Array.prototype.filter`.
8 * It takes two new parameters to its callback function: the current index, and the entire list.
9 *
10 * `filterIndexed` implementation is simple: `
11 * const filterIndexed = R.addIndex(R.filter);
12 * `
13 *
14 * @func filterIndexed
15 * @memberOf RA
16 * @since {@link https://char0n.github.io/ramda-adjunct/2.31.0|v2.31.0}
17 * @category List
18 * @typedef Idx = Number
19 * @sig Filterable f => ((a, Idx, f a) -> Boolean) -> f a -> f a
20 * @param {Function} pred The predicate function
21 * @param {Array} list The collection to filter
22 * @return {Array} Filterable
23 * @see {@link http://ramdajs.com/docs/#addIndex|R.addIndex}, {@link http://ramdajs.com/docs/#filter|R.filter}
24 * @example
25 *
26 * const isValueGtIndex = (val, idx) => val > idx;
27 * RA.filterIndexed(isValueGtIndex, [5, 4, 3, 2, 1, 0]); //=> [5, 4, 3]
28 */
29var filterIndexed = (0, _ramda.addIndex)(_ramda.filter);
30var _default = filterIndexed;
31exports["default"] = _default;
Note: See TracBrowser for help on using the repository browser.