Methods
Sets the iterator return type to return entries where each value is an array containing the
subscript and node value, returns this for chaining and for direct usage in for-of loops.
Sets the iterator return type to return keys only (subscripts), returns this for chaining
and for direct usage in for-of loops.
#
next() → {any}
Positions the iterator at the next sibling node in collation order and return an object
containing done and value properties. If the iterator is at end then done is true, otherwise it
is false. The value property returned when done is false is either the subscript, the node
value, or an array whose first element is the subscript and the second is the global node value.
The return value type defaults to the array containing the subscript and value. The return type
can be changed by invoking the entries(), keys(), or values() methods.
Sets the iterator return type to return nodeEntries where each value is an array containing the
subscript and sub-node (IRISGlobalNode),
returns this for chaining and for direct usage in for-of loops.
Sets the iterator return type to return only sub-nodes
(IRISGlobalNode),
returns this for chaining and for direct usage in for-of loops.
Reverses the iterator, returns this for chaining and for direct usage in for-of loops.
Positions the iterator to start from subscript, returns this() for chaining.
After calling this method, use next() to advance the iterator to the next defined
sub-node in alphabetic collating sequence.
Parameters:
Name |
Type |
Description |
subscript |
any
|
the value of the subscript where the iterator is to be positioned |
Example
// For example, for the following global and iterator:
// ^gbl("a")=11
// ^gbl("b")=22
// ^gbl("e")=55
itr = iris.iterator("^gbl")
// The starting position may be a valid sub-node, in which case the next sub-node will be the next valid one.
itr.startFrom("a")
for (let pair of itr) {
let [sub, val] = pair
console.log(sub, '->', val)
}
// prints:
// b -> 22
// e -> 55
// The starting position may also be an invalid sub-node, in which case the next sub-node will be the
// first valid one in alphabetic collating sequence after the given subscript.
itr.startFrom("c")
for (let pair of itr) {
let [sub, val] = pair
console.log(sub, '->', val) // prints: e -> 55
}
// Calling this method with undefined as an argument is the same as using the default starting position,
// which is just before the first node, or just after the last node, depending on the iterator direction.
Alias for the keys() function.
Sets the iterator return type to return keys only (subscripts), returns this for chaining and
for direct usage in for-of loops.
Sets the iterator return type to return only values, returns this for chaining
and for direct usage in for-of loops.