You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
16 lines
350 B
16 lines
350 B
'use strict';
|
|
|
|
/**
|
|
* Convert the specified value to an array. If an array is specified, the array is returned as-is.
|
|
*
|
|
* @template T
|
|
* @param {T | T[] | undefined | null} value
|
|
* @returns {T[] | undefined}
|
|
*/
|
|
module.exports = function flattenArray(value) {
|
|
if (value == null) {
|
|
return;
|
|
}
|
|
|
|
return Array.isArray(value) ? value : [value];
|
|
};
|
|
|