Home Manual Reference Source

Examples

More examples in the test files.

StopIteration

import { iter } from '@iterable-iterator/iter' ;
import { next } from '@nextable-nextator/next' ;
import { StopIteration } from '@failure-abstraction/error' ;

const data = [] ;
const it = iter(data) ;

try {
    next(it);
}
catch ( e ) {
  if (e instanceof StopIteration) {
    ...
  }
}