[d24f17c] | 1 | "use strict";
|
---|
| 2 |
|
---|
| 3 | exports.__esModule = true;
|
---|
| 4 | exports["default"] = void 0;
|
---|
| 5 | var _ramda = require("ramda");
|
---|
| 6 | // helpers
|
---|
| 7 | var rejectIndexed = (0, _ramda.addIndex)(_ramda.reject);
|
---|
| 8 | var containsIndex = (0, _ramda.curry)(function (indexes, val, index) {
|
---|
| 9 | return (0, _ramda.includes)(index, indexes);
|
---|
| 10 | });
|
---|
| 11 |
|
---|
| 12 | /**
|
---|
| 13 | * Returns a partial copy of an array omitting the indexes specified.
|
---|
| 14 | *
|
---|
| 15 | * @func omitIndexes
|
---|
| 16 | * @memberOf RA
|
---|
| 17 | * @since {@link https://char0n.github.io/ramda-adjunct/1.19.0|v1.19.0}
|
---|
| 18 | * @category List
|
---|
| 19 | * @sig [Int] -> [a] -> [a]
|
---|
| 20 | * @see {@link http://ramdajs.com/docs/#omit|R.omit}, {@link RA.pickIndexes|pickIndexes}
|
---|
| 21 | * @param {!Array} indexes The array of indexes to omit from the new array
|
---|
| 22 | * @param {!Array} list The array to copy from
|
---|
| 23 | * @return {!Array} The new array with omitted indexes
|
---|
| 24 | * @example
|
---|
| 25 | *
|
---|
| 26 | * RA.omitIndexes([-1, 1, 3], ['a', 'b', 'c', 'd']); //=> ['a', 'c']
|
---|
| 27 | */
|
---|
| 28 | var omitIndexes = (0, _ramda.curry)(function (indexes, list) {
|
---|
| 29 | return rejectIndexed(containsIndex(indexes), list);
|
---|
| 30 | });
|
---|
| 31 | var _default = omitIndexes;
|
---|
| 32 | exports["default"] = _default; |
---|