From 1c9c97ffe6d09ccda3c01e56aa0667b67132b455 Mon Sep 17 00:00:00 2001 From: Kevin Jahns Date: Sat, 23 Apr 2022 15:13:26 +0200 Subject: [PATCH] add yxml.forEach method - closes #421 --- src/types/YXmlFragment.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/types/YXmlFragment.js b/src/types/YXmlFragment.js index c18b9ca0..8c462236 100644 --- a/src/types/YXmlFragment.js +++ b/src/types/YXmlFragment.js @@ -404,6 +404,15 @@ export class YXmlFragment extends AbstractType { return typeListSlice(this, start, end) } + /** + * Executes a provided function on once on overy child element. + * + * @param {function(YXmlElement|YXmlText,number, typeof this):void} f A function to execute on every element of this YArray. + */ + forEach (f) { + typeListForEach(this, f) + } + /** * Transform the properties of this type to binary and write it to an * BinaryEncoder.