Replies: 1 comment
-
Yes good idea! I have the same issues, I would love to have the following methods:
I'm not sure yet if I would like to have them both recursive or shallow, or only recursive. I feel like only recursive would be best. Can you explain a bit more about your idea with a proxy? Right now every different node class has one or a few properties that need to be iterated. For example |
Beta Was this translation helpful? Give feedback.
-
Right now we have
Node.forEach
,Node.map
, etc which are very useful for navigating and modifying node children, however I find myself doing things likenode.args.some(...)
,node.args.every(...)
fairly often and it'd be a bit nicer to be able to donode.some(...)
,node.every(...)
instead.Relatedly, I wonder if we might actually consider rewriting the existing Array-like methods on Node using a Proxy. This would mean we're relying on Javascript's internal implementation rather than having to reimplement each ourselves. A good example might be https://www.30secondsofcode.org/articles/s/javascript-object-array-proxy
Beta Was this translation helpful? Give feedback.
All reactions