git » sdk » commit 1beec32

Stanza: Add hasChild() helper

author Matthew Wild
2025-04-18 13:50:12 UTC
committer Matthew Wild
2025-04-18 13:50:12 UTC
parent 382d49452895a034c85b3bbc6c5edc8c0d8be077

Stanza: Add hasChild() helper

snikket/Stanza.hx +4 -0

diff --git a/snikket/Stanza.hx b/snikket/Stanza.hx
index 27b345e..62b3c49 100644
--- a/snikket/Stanza.hx
+++ b/snikket/Stanza.hx
@@ -254,6 +254,10 @@ class Stanza implements NodeInterface {
 		return child.getText();
 	}
 
+	public function hasChild(?name:Null<String>, ?xmlns:Null<String>):Bool {
+		return getChild(name, xmlns) != null;
+	}
+
 	public function getText():String {
 		return allText().join("");
 	}