This class provides an iterable interface
that behaves like a virtual dictionary representing the immediate children of a global node.
IRISGlobalNode, which behaves like a virtual
dictionary representing the immediate children of a global array node.
IRISGlobalNode is iterable: IRISGlobalNode supports iterable interface using for-of loop.
for (let x of node) console.log(x)
It implements the JavaScript Iterator protocol, which means it implements the [Symbol.iterator]
function. This function returns an Iterator over
subscript-value pairs of the node (like a call to the entries() function). This allows IRISGlobalNode to be iterated directly within a for-of
loop as seen above, but one can also invoke the [Symbol.iterator] function directly to obtain an iterator.
const iterator = node[Symbol.iterator]()
const nextPair = iterator.next()
console.log(nextPair)
IRISGlobalNode can be iterated in many different ways:
Methods keys(), subscripts(), values(), entries(), nodes(), and nodeEntries() return iterators
over different views of the IRISGlobalNode subscript-value pairs.
For example, the items() method returns an iterator over the sub-nodes of the IRISGlobalNode.
for (let x of node.nodes()) console.log(x)
IRISGlobalNode is reversable:
If the function reverse() gets called the iteration of the IRISGlobalNode will go backwards / reversed from the standard order.
For example:
for (let x of node.reverse().entries()) console.log(x)
will traverse the subscripts from last (inclusive) to first (exclusive).
Finally, IRISGlobalNode supports membership tests (has), and allows setting or getting
subscript-value pairs