| 1 | # stop-iteration-iterator <sup>[![Version Badge][npm-version-svg]][package-url]</sup>
|
|---|
| 2 |
|
|---|
| 3 | [![github actions][actions-image]][actions-url]
|
|---|
| 4 | [![coverage][codecov-image]][codecov-url]
|
|---|
| 5 | [![License][license-image]][license-url]
|
|---|
| 6 | [![Downloads][downloads-image]][downloads-url]
|
|---|
| 7 |
|
|---|
| 8 | [![npm badge][npm-badge-png]][package-url]
|
|---|
| 9 |
|
|---|
| 10 | Firefox 17-26 iterators throw a StopIteration object to indicate "done". This normalizes it.
|
|---|
| 11 |
|
|---|
| 12 | # Usage
|
|---|
| 13 |
|
|---|
| 14 | ```js
|
|---|
| 15 | var stopIterationIterator = require('stop-iteration-iterator');
|
|---|
| 16 |
|
|---|
| 17 | var s = new Set([1, 2]);
|
|---|
| 18 |
|
|---|
| 19 | var iterator = stopIterationIterator(s.keys());
|
|---|
| 20 |
|
|---|
| 21 | iterator.next(); // { done: false, value: 1 }
|
|---|
| 22 | ```
|
|---|
| 23 |
|
|---|
| 24 | ## Tests
|
|---|
| 25 | Simply clone the repo, `npm install`, and run `npm test`
|
|---|
| 26 |
|
|---|
| 27 |
|
|---|
| 28 | [package-url]: https://npmjs.org/package/stop-iteration-iterator
|
|---|
| 29 | [npm-version-svg]: https://versionbadg.es/ljharb/stop-iteration-iterator.svg
|
|---|
| 30 | [deps-svg]: https://david-dm.org/ljharb/stop-iteration-iterator.svg
|
|---|
| 31 | [deps-url]: https://david-dm.org/ljharb/stop-iteration-iterator
|
|---|
| 32 | [dev-deps-svg]: https://david-dm.org/ljharb/stop-iteration-iterator/dev-status.svg
|
|---|
| 33 | [dev-deps-url]: https://david-dm.org/ljharb/stop-iteration-iterator#info=devDependencies
|
|---|
| 34 | [npm-badge-png]: https://nodei.co/npm/stop-iteration-iterator.png?downloads=true&stars=true
|
|---|
| 35 | [license-image]: https://img.shields.io/npm/l/stop-iteration-iterator.svg
|
|---|
| 36 | [license-url]: LICENSE
|
|---|
| 37 | [downloads-image]: https://img.shields.io/npm/dm/stop-iteration-iterator.svg
|
|---|
| 38 | [downloads-url]: https://npm-stat.com/charts.html?package=stop-iteration-iterator
|
|---|
| 39 | [codecov-image]: https://codecov.io/gh/ljharb/stop-iteration-iterator/branch/main/graphs/badge.svg
|
|---|
| 40 | [codecov-url]: https://app.codecov.io/gh/ljharb/stop-iteration-iterator/
|
|---|
| 41 | [actions-image]: https://img.shields.io/endpoint?url=https://github-actions-badge-u3jn4tfpocch.runkit.sh/ljharb/stop-iteration-iterator
|
|---|
| 42 | [actions-url]: https://github.com/ljharb/stop-iteration-iterator/actions
|
|---|