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/#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 | */
|
---|
29 | var filterIndexed = (0, _ramda.addIndex)(_ramda.filter);
|
---|
30 | var _default = filterIndexed;
|
---|
31 | exports["default"] = _default; |
---|