concatArrays

concatArrays

Gets some nullable arrays and returns concatenation of existing ones.

Import

import { concatArrays } from '@fullstacksjs/toolbox';

Signature

function concatArrays<T extends any[]>(...mas: T): T[] {}

Examples

concatArrays(undefined)                       // []
concatArrays(null, undefined)                 // []
concatArrays([])                              // []
concatArrays(undefined, [1, 2], null)         // [1, 2]
concatArrays(undefined, [1, 2], null, [3, 4]) // [1, 2, 3, 4]
concatArrays([1, 2], ['3', '4'])              // [1, 2, '3', '4']
concatArrays([1, 2])                          // [1, 2]