UNPKG

shelving

Version:

Toolkit for using data in JavaScript.

16 lines (15 loc) 524 B
/** Abstract generator designed to be extended that implements the full generator protocol. */ export class AbstractIterator { throw(thrown) { // Default behaviour for a generator is to throw the error back out of the iterator and not continue. throw thrown; } return(value) { // Default behaviour for a generator is to return `done: true` and the input value. return { done: true, value }; } // Implement `Iterable` [Symbol.iterator]() { return this; } }