source: node_modules/ramda/src/internal/_concat.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: 709 bytes
Line 
1/**
2 * Private `concat` function to merge two array-like objects.
3 *
4 * @private
5 * @param {Array|Arguments} [set1=[]] An array-like object.
6 * @param {Array|Arguments} [set2=[]] An array-like object.
7 * @return {Array} A new, merged array.
8 * @example
9 *
10 * _concat([4, 5, 6], [1, 2, 3]); //=> [4, 5, 6, 1, 2, 3]
11 */
12function _concat(set1, set2) {
13 set1 = set1 || [];
14 set2 = set2 || [];
15 var idx;
16 var len1 = set1.length;
17 var len2 = set2.length;
18 var result = [];
19 idx = 0;
20
21 while (idx < len1) {
22 result[result.length] = set1[idx];
23 idx += 1;
24 }
25
26 idx = 0;
27
28 while (idx < len2) {
29 result[result.length] = set2[idx];
30 idx += 1;
31 }
32
33 return result;
34}
35
36module.exports = _concat;
Note: See TracBrowser for help on using the repository browser.