Methods
current() → {Object|Number|Boolean}
Returns the current element of the iterator
Returns
-
Object
current
-
Number
[current.value]
-
Boolean
current.done
Example
import { array } from 'vectorious/core/array';
import { NDIter } from 'vectorious/iterator';
const iter = new NDIter(array([1, 2, 3]));
iter.current(); // { value: 1, done: false }
Source
done() → {Boolean}
Returns true if the iterator is done, false otherwise
Returns
-
Boolean
Example
import { array } from 'vectorious/core/array';
import { NDIter } from 'vectorious/iterator';
const iter = new NDIter(array([1, 2, 3]));
iter.done(); // false
Source
next() → {Object}
Steps to the next position in the iterator. Returns the current index of the iterator, or undefined if done.
Returns
-
Object
Example
import { array } from 'vectorious/core/array';
import { NDIter } from 'vectorious/iterator';
const iter = new NDIter(array([1, 2, 3]));
iter.next(); // { value: 2, done: false }
iter.next(); // { value: 3, done: false }
iter.next(); // { done: true }
Source
next1d()
Steps to the next position in the iterator, assuming it is 1 dimensional.
Source
next2d()
Steps to the next position in the iterator, assuming it is 2 dimensional.
Source
next2d()
Steps to the next position in the iterator