Only identify Struct as empty when it has no keys. (#6092)

* Fix isEmpty on Struct

* Improve code
This commit is contained in:
Valentin Fernandez
2025-02-12 08:09:40 -05:00
committed by GitHub
parent 7bd4c7afb0
commit 21a28e003a
+2 -8
View File
@@ -154,16 +154,10 @@ export class Struct<
}
/**
* @description Checks if the value is an empty value
* @description Checks if the value is an empty value '{}'
*/
public get isEmpty (): boolean {
for (const v of this.values()) {
if (!v.isEmpty) {
return false;
}
}
return true;
return [...this.keys()].length === 0;
}
/**