Initial commit
[yaffs-website] / node_modules / grunt-contrib-watch / node_modules / lodash / chain / wrapperConcat.js
1 var arrayConcat = require('../internal/arrayConcat'),
2     baseFlatten = require('../internal/baseFlatten'),
3     isArray = require('../lang/isArray'),
4     restParam = require('../function/restParam'),
5     toObject = require('../internal/toObject');
6
7 /**
8  * Creates a new array joining a wrapped array with any additional arrays
9  * and/or values.
10  *
11  * @name concat
12  * @memberOf _
13  * @category Chain
14  * @param {...*} [values] The values to concatenate.
15  * @returns {Array} Returns the new concatenated array.
16  * @example
17  *
18  * var array = [1];
19  * var wrapped = _(array).concat(2, [3], [[4]]);
20  *
21  * console.log(wrapped.value());
22  * // => [1, 2, 3, [4]]
23  *
24  * console.log(array);
25  * // => [1]
26  */
27 var wrapperConcat = restParam(function(values) {
28   values = baseFlatten(values);
29   return this.thru(function(array) {
30     return arrayConcat(isArray(array) ? array : [toObject(array)], values);
31   });
32 });
33
34 module.exports = wrapperConcat;