source: node_modules/ramda-adjunct/lib/concatAll.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.8 KB
RevLine 
[d24f17c]1"use strict";
2
3exports.__esModule = true;
4exports["default"] = void 0;
5var _ramda = require("ramda");
6var _stubUndefined = _interopRequireDefault(require("./stubUndefined"));
7function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
8var 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 */
35var concatAll = (0, _ramda.pipe)((0, _ramda.reduce)(_ramda.concat, leftIdentitySemigroup), (0, _ramda.when)((0, _ramda.identical)(leftIdentitySemigroup), _stubUndefined["default"]));
36var _default = concatAll;
37exports["default"] = _default;
Note: See TracBrowser for help on using the repository browser.