main
|
Last change
on this file was d24f17c, checked in by Aleksandar Panovski <apano77@…>, 20 months ago |
|
Initial commit
|
-
Property mode
set to
100644
|
|
File size:
892 bytes
|
| Rev | Line | |
|---|
| [d24f17c] | 1 | var _curry2 =
|
|---|
| 2 | /*#__PURE__*/
|
|---|
| 3 | require("./internal/_curry2.js");
|
|---|
| 4 |
|
|---|
| 5 | var length =
|
|---|
| 6 | /*#__PURE__*/
|
|---|
| 7 | require("./length.js");
|
|---|
| 8 |
|
|---|
| 9 | var slice =
|
|---|
| 10 | /*#__PURE__*/
|
|---|
| 11 | require("./slice.js");
|
|---|
| 12 | /**
|
|---|
| 13 | * Splits a given list or string at a given index.
|
|---|
| 14 | *
|
|---|
| 15 | * @func
|
|---|
| 16 | * @memberOf R
|
|---|
| 17 | * @since v0.19.0
|
|---|
| 18 | * @category List
|
|---|
| 19 | * @sig Number -> [a] -> [[a], [a]]
|
|---|
| 20 | * @sig Number -> String -> [String, String]
|
|---|
| 21 | * @param {Number} index The index where the array/string is split.
|
|---|
| 22 | * @param {Array|String} array The array/string to be split.
|
|---|
| 23 | * @return {Array}
|
|---|
| 24 | * @example
|
|---|
| 25 | *
|
|---|
| 26 | * R.splitAt(1, [1, 2, 3]); //=> [[1], [2, 3]]
|
|---|
| 27 | * R.splitAt(5, 'hello world'); //=> ['hello', ' world']
|
|---|
| 28 | * R.splitAt(-1, 'foobar'); //=> ['fooba', 'r']
|
|---|
| 29 | */
|
|---|
| 30 |
|
|---|
| 31 |
|
|---|
| 32 | var splitAt =
|
|---|
| 33 | /*#__PURE__*/
|
|---|
| 34 | _curry2(function splitAt(index, array) {
|
|---|
| 35 | return [slice(0, index, array), slice(index, length(array), array)];
|
|---|
| 36 | });
|
|---|
| 37 |
|
|---|
| 38 | module.exports = splitAt; |
|---|
Note:
See
TracBrowser
for help on using the repository browser.