@kaelyx/ts-kit / array / concatenate
Function: concatenate()
concatenate<
T>(first,second,options?):T[]
Defined in: array/concatenate/concatenate.ts:23
Joins two arrays into one new array.
Type Parameters
T
T
Parameters
first
readonly T[]
The first array. The function does not change it.
second
readonly T[]
The second array. The function does not change it.
options?
ConcatenateOptions = {}
Optional. See ConcatenateOptions.
Returns
T[]
A new array with the items of first, then the items of second.
Example
ts
concatenate([1, 2], [3]) // [1, 2, 3]
concatenate([1, 2], [2, 3], { unique: true }) // [1, 2, 3]
concatenate([1, 1, 2], [2, 3], { unique: true }) // [1, 2, 3]
concatenate(['a'], []) // ['a']Types
ConcatenateOptions type
ConcatenateOptions =
object
Defined in: array/concatenate/concatenate.types.ts:5
Options for concatenate.
Properties
unique?
readonlyoptionalunique?:boolean
Defined in: array/concatenate/concatenate.types.ts:7
If true, the result holds each value one time only. Default: false.