[d24f17c] | 1 | "use strict";
|
---|
| 2 |
|
---|
| 3 | exports.__esModule = true;
|
---|
| 4 | exports["default"] = void 0;
|
---|
| 5 | var _ramda = require("ramda");
|
---|
| 6 | var _stubUndefined = _interopRequireDefault(require("./stubUndefined"));
|
---|
| 7 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
---|
| 8 | var leftIdentitySemigroup = {
|
---|
| 9 | concat: _ramda.identity
|
---|
| 10 | };
|
---|
| 11 |
|
---|
| 12 | /**
|
---|
| 13 | * Returns the result of concatenating the given lists or strings.
|
---|
| 14 | * Note: RA.concatAll expects all elements to be of the same type. It will throw an error if you concat an Array with a non-Array value.
|
---|
| 15 | * Dispatches to the concat method of the preceding element, if present. Can also concatenate multiple elements of a [fantasy-land compatible semigroup](https://github.com/fantasyland/fantasy-land#semigroup).
|
---|
| 16 | * Returns undefined if empty array was passed.
|
---|
| 17 | *
|
---|
| 18 | * @func concatAll
|
---|
| 19 | * @memberOf RA
|
---|
| 20 | * @since {@link https://char0n.github.io/ramda-adjunct/2.6.0|v2.6.0}
|
---|
| 21 | * @category List
|
---|
| 22 | * @sig [[a]] -> [a] | Undefined
|
---|
| 23 | * @sig [String] -> String | Undefined
|
---|
| 24 | * @sig Semigroup s => Foldable s f => f -> s | Undefined
|
---|
| 25 | * @param {Array.<Array|string>} list List containing elements that will be concatenated
|
---|
| 26 | * @return {Array|string|undefined} Concatenated elements
|
---|
| 27 | * @see {@link http://ramdajs.com/docs/#concat|R.concat}, {@link RA.concatRight|concatRight}, {@link http://ramdajs.com/docs/#unnest|R.unnest}, {@link http://ramdajs.com/docs/#join|R.join}
|
---|
| 28 | * @example
|
---|
| 29 | *
|
---|
| 30 | * concatAll([[1], [2], [3]]); //=> [1, 2, 3]
|
---|
| 31 | * concatAll(['1', '2', '3']); //=> '123'
|
---|
| 32 | * concatAll([]); //=> undefined
|
---|
| 33 | * concatAll(null); //=> undefined
|
---|
| 34 | */
|
---|
| 35 | var concatAll = (0, _ramda.pipe)((0, _ramda.reduce)(_ramda.concat, leftIdentitySemigroup), (0, _ramda.when)((0, _ramda.identical)(leftIdentitySemigroup), _stubUndefined["default"]));
|
---|
| 36 | var _default = concatAll;
|
---|
| 37 | exports["default"] = _default; |
---|