149a0bbd1d4b48c37c127a850feea210f07b42dc5e01547a5389d2c1dcbfb9bd1986cd87d14dab08977d7bc6de90d189d20fa43c7686ec1709fb48b3dc4850 1.8 KB

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