As noted in an issue, removing all elements from an OrderedMap except those that fulfill some criteria (known as "filtering" in functional contexts) is not straight-forward and contains a pitfall.
I have added a Filter function that is passed a predicate function and avoids this pitfall. The predicate function should return true if the key&value fit the criteria and should be kept and false otherwise, as may be familiar from other programming languages (e.g. python: filter)
Additionally I have added an example of this to the README. The new iteration syntax is now also showcased there.
As noted in an issue, removing all elements from an OrderedMap except those that fulfill some criteria (known as "filtering" in functional contexts) is not straight-forward and contains a pitfall.
I have added a
Filter
function that is passed a predicate function and avoids this pitfall. The predicate function should return true if the key&value fit the criteria and should be kept and false otherwise, as may be familiar from other programming languages (e.g. python: filter)Additionally I have added an example of this to the README. The new iteration syntax is now also showcased there.