[ENG-3833] handle object in is bool (#3974)

* handle object in is bool

* use if statements
This commit is contained in:
Khaleel Al-Adhami 2024-09-23 18:14:28 -07:00 committed by GitHub
parent a5ad5203df
commit 00d995d971
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -832,7 +832,9 @@ export const useEventLoop = (
* @returns True if the value is truthy, false otherwise.
*/
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);
};
/**