ih-portal
Version:
A project for connecting interaction hub services with catalyst-ui components
23 lines (17 loc) • 311 B
JavaScript
/**
* Does its best to return a valid array.
* @param {array or object} obj
* @return {array} Empty array, array of obj, or existing array
*/
function toArray( obj) {
if (!obj) {
return ([]);
}
if (Array.isArray(obj)) {
return obj;
}
return [obj];
}
module.exports = {
toArray,
};