Simplify concat.

This commit is contained in:
John-David Dalton
2017-02-20 23:28:46 -08:00
parent 3a375c0ae1
commit 2a3296111d

View File

@@ -1,4 +1,3 @@
import arrayPush from './.internal/arrayPush.js'
import baseFlatten from './.internal/baseFlatten.js' import baseFlatten from './.internal/baseFlatten.js'
import copyArray from './.internal/copyArray.js' import copyArray from './.internal/copyArray.js'
@@ -23,7 +22,9 @@ import copyArray from './.internal/copyArray.js'
* // => [1] * // => [1]
*/ */
function concat(array, ...values) { function concat(array, ...values) {
return arrayPush(Array.isArray(array) ? copyArray(array) : [array], baseFlatten(values, 1)) const result = Array.isArray(array) ? copyArray(array) : [array]
result.push(...baseFlatten(values, 1))
return result
} }
export default concat export default concat