normalized the caster to return always non-null value and fixed minor ui issues
This commit is contained in:
@@ -118,15 +118,15 @@ export default class CommonHelper {
|
||||
* Normalizes and returns arr as a valid array instance (if not already).
|
||||
*
|
||||
* @param {Array} arr
|
||||
* @param {Boolean} [allowNull]
|
||||
* @param {Boolean} [allowEmpty]
|
||||
* @return {Array}
|
||||
*/
|
||||
static toArray(arr, allowNull = false) {
|
||||
static toArray(arr, allowEmpty = false) {
|
||||
if (Array.isArray(arr)) {
|
||||
return arr;
|
||||
}
|
||||
|
||||
return (allowNull || arr !== null) && typeof arr !== "undefined" ? [arr] : [];
|
||||
return (allowEmpty || !CommonHelper.isEmpty(arr)) && typeof arr !== "undefined" ? [arr] : [];
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user