[ENG-3833] handle object in is bool (#3974)
* handle object in is bool * use if statements
This commit is contained in:
parent
a5ad5203df
commit
00d995d971
@ -832,7 +832,9 @@ export const useEventLoop = (
|
|||||||
* @returns True if the value is truthy, false otherwise.
|
* @returns True if the value is truthy, false otherwise.
|
||||||
*/
|
*/
|
||||||
export const isTrue = (val) => {
|
export const isTrue = (val) => {
|
||||||
return Array.isArray(val) ? val.length > 0 : !!val;
|
if (Array.isArray(val)) return val.length > 0;
|
||||||
|
if (val === Object(val)) return Object.keys(val).length > 0;
|
||||||
|
return Boolean(val);
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user