mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-08 10:17:48 +00:00
Simplify concat.
This commit is contained in:
@@ -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
|
||||||
|
|||||||
Reference in New Issue
Block a user