source: trip-planner-front/node_modules/lodash/concat.js@ 188ee53

Last change on this file since 188ee53 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 1007 bytes
Line 
1var arrayPush = require('./_arrayPush'),
2 baseFlatten = require('./_baseFlatten'),
3 copyArray = require('./_copyArray'),
4 isArray = require('./isArray');
5
6/**
7 * Creates a new array concatenating `array` with any additional arrays
8 * and/or values.
9 *
10 * @static
11 * @memberOf _
12 * @since 4.0.0
13 * @category Array
14 * @param {Array} array The array to concatenate.
15 * @param {...*} [values] The values to concatenate.
16 * @returns {Array} Returns the new concatenated array.
17 * @example
18 *
19 * var array = [1];
20 * var other = _.concat(array, 2, [3], [[4]]);
21 *
22 * console.log(other);
23 * // => [1, 2, 3, [4]]
24 *
25 * console.log(array);
26 * // => [1]
27 */
28function concat() {
29 var length = arguments.length;
30 if (!length) {
31 return [];
32 }
33 var args = Array(length - 1),
34 array = arguments[0],
35 index = length;
36
37 while (index--) {
38 args[index - 1] = arguments[index];
39 }
40 return arrayPush(isArray(array) ? copyArray(array) : [array], baseFlatten(args, 1));
41}
42
43module.exports = concat;
Note: See TracBrowser for help on using the repository browser.