source: node_modules/ramda-adjunct/lib/omitIndexes.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.0 KB
Line 
1"use strict";
2
3exports.__esModule = true;
4exports["default"] = void 0;
5var _ramda = require("ramda");
6// helpers
7var rejectIndexed = (0, _ramda.addIndex)(_ramda.reject);
8var 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 */
28var omitIndexes = (0, _ramda.curry)(function (indexes, list) {
29 return rejectIndexed(containsIndex(indexes), list);
30});
31var _default = omitIndexes;
32exports["default"] = _default;
Note: See TracBrowser for help on using the repository browser.