mirror of
https://github.com/pocketbase/pocketbase.git
synced 2026-10-11 16:57:26 +02:00
normalized the caster to return always non-null value and fixed minor ui issues
This commit is contained in:
1 parent
f19b9e3552
commit
994761b728
34 files changed
+346
-321
No files matched your search
@@ -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