mirror of
https://github.com/fleetbase/fleetbase.git
synced 2025-12-19 22:27:22 +00:00
21 lines
377 B
JavaScript
21 lines
377 B
JavaScript
module.exports = function asArray(value) {
|
|
if (Array.isArray(value)) {
|
|
return value;
|
|
}
|
|
|
|
if (typeof value === 'string') {
|
|
return value.split(',');
|
|
}
|
|
|
|
try {
|
|
let iterable = Array.from(value);
|
|
if (Array.isArray(iterable)) {
|
|
return iterable;
|
|
}
|
|
} catch (error) {
|
|
return [];
|
|
}
|
|
|
|
return [];
|
|
};
|