git » sdk » commit 21145d1

Stanza: Add hasChild() helper

author Matthew Wild
2025-04-18 13:50:12 UTC
committer Stephen Paul Weber
2025-09-29 13:41:52 UTC
parent dbd515bb11afdd418c4e515905c5156c859f8b35

Stanza: Add hasChild() helper

snikket/Stanza.hx +4 -0

diff --git a/snikket/Stanza.hx b/snikket/Stanza.hx
index 7a18f9a..b1358f1 100644
--- a/snikket/Stanza.hx
+++ b/snikket/Stanza.hx
@@ -291,6 +291,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("");
 	}