dynamodb-toolbox
dynamodb-toolbox copied to clipboard
Follow Iterators and Generators pattern with the `next` helpers
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Iterators_and_Generators
In JavaScript an iterator is an object which defines a sequence and potentially a return value upon its termination.
Specifically, an iterator is any object which implements the Iterator protocol by having a next() method that returns an object with two properties:
- value
- The next value in the iteration sequence.
- done
- This is true if the last value in the sequence has already been consumed. If value is present alongside done, it is the iterator's return value.
Once created, an iterator object can be iterated explicitly by repeatedly calling
next(). Iterating over an iterator is said to consume the iterator, because it is generally only possible to do once. After a terminating value has been yielded additional calls tonext()should continue to return{done: true}.
Another good explanation on iterators: https://javascript.info/iterable