normalized the caster to return always non-null value and fixed minor ui issues

This commit is contained in:
Gani Georgiev
2022-07-18 00:16:09 +03:00
parent f19b9e3552
commit 994761b728
34 changed files with 346 additions and 321 deletions
+3 -3
View File
@@ -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] : [];
}
/**