Usage
First, require the polyfill at the entry point of your application
require( 'regenerator-runtime/runtime' ) ;
// or
import 'regenerator-runtime/runtime.js' ;
Then, import the library where needed
const { ... } = require( '@failure-abstraction/error' ) ;
// or
import { ... } from '@failure-abstraction/error' ;
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) {
...
}
}