UNPKG

975 BJavaScriptView Raw
1var _curry3 =
2/*#__PURE__*/
3require("./internal/_curry3");
4/**
5 * Removes the sub-list of `list` starting at index `start` and containing
6 * `count` elements. _Note that this is not destructive_: it returns a copy of
7 * the list with the changes.
8 * <small>No lists have been harmed in the application of this function.</small>
9 *
10 * @func
11 * @memberOf R
12 * @since v0.2.2
13 * @category List
14 * @sig Number -> Number -> [a] -> [a]
15 * @param {Number} start The position to start removing elements
16 * @param {Number} count The number of elements to remove
17 * @param {Array} list The list to remove from
18 * @return {Array} A new Array with `count` elements from `start` removed.
19 * @see R.without
20 * @example
21 *
22 * R.remove(2, 3, [1,2,3,4,5,6,7,8]); //=> [1,2,6,7,8]
23 */
24
25
26var remove =
27/*#__PURE__*/
28_curry3(function remove(start, count, list) {
29 var result = Array.prototype.slice.call(list, 0);
30 result.splice(start, count);
31 return result;
32});
33
34module.exports = remove;
\No newline at end of file