dotfiles/.vscode/extensions/vscodevim.vim-0.2.0/node_modules/lodash/concat.js
Cyryl Płotnicki 280bcab25f VSCode update
2016-09-24 13:12:34 +02:00

42 lines
1,006 B
JavaScript

var arrayPush = require('./_arrayPush'),
baseFlatten = require('./_baseFlatten'),
copyArray = require('./_copyArray'),
isArray = require('./isArray');
/**
* Creates a new array concatenating `array` with any additional arrays
* and/or values.
*
* @static
* @memberOf _
* @since 4.0.0
* @category Array
* @param {Array} array The array to concatenate.
* @param {...*} [values] The values to concatenate.
* @returns {Array} Returns the new concatenated array.
* @example
*
* var array = [1];
* var other = _.concat(array, 2, [3], [[4]]);
*
* console.log(other);
* // => [1, 2, 3, [4]]
*
* console.log(array);
* // => [1]
*/
function concat() {
var length = arguments.length,
args = Array(length ? length - 1 : 0),
array = arguments[0],
index = length;
while (index--) {
args[index - 1] = arguments[index];
}
return length
? arrayPush(isArray(array) ? copyArray(array) : [array], baseFlatten(args, 1))
: [];
}
module.exports = concat;