{"_id":"iterate-iterator","_rev":"1086116","name":"iterate-iterator","description":"Iterate any JS iterator. Works robustly in all environments, all versions.","dist-tags":{"latest":"1.0.2"},"maintainers":[{"name":"ljharb","email":""}],"time":{"modified":"2021-10-01T22:00:57.000Z","created":"2020-01-18T08:58:43.385Z","1.0.2":"2021-10-01T21:56:24.652Z","1.0.1":"2020-01-18T09:04:27.823Z","1.0.0":"2020-01-18T08:58:43.385Z"},"users":{},"author":{"name":"Jordan Harband","email":"ljharb@gmail.com"},"repository":{"type":"git","url":"git+https://github.com/ljharb/iterate-iterator.git"},"versions":{"1.0.2":{"name":"iterate-iterator","version":"1.0.2","description":"Iterate any JS iterator. Works robustly in all environments, all versions.","main":"index.js","exports":{".":[{"default":"./index.js"},"./index.js"],"./package.json":"./package.json"},"scripts":{"prepublishOnly":"safe-publish-latest","prepublish":"not-in-publish || npm run prepublishOnly","pretest":"npm run lint","prelint":"evalmd README.md","lint":"eslint .","tests-only":"nyc tape 'test/**/*.js'","test":"npm run tests-only","posttest":"aud --production","version":"auto-changelog && git add CHANGELOG.md","postversion":"auto-changelog && git add CHANGELOG.md && git commit --no-edit --amend && git tag -f \"v$(node -e \"console.log(require('./package.json').version)\")\""},"repository":{"type":"git","url":"git+https://github.com/ljharb/iterate-iterator.git"},"keywords":["iterate","iterator","iterable","es2015","es6","symbol.iterator","symbol","next"],"author":{"name":"Jordan Harband","email":"ljharb@gmail.com"},"funding":{"url":"https://github.com/sponsors/ljharb"},"license":"MIT","bugs":{"url":"https://github.com/ljharb/iterate-iterator/issues"},"homepage":"https://github.com/ljharb/iterate-iterator#readme","devDependencies":{"@ljharb/eslint-config":"^18.0.0","aud":"^1.1.5","auto-changelog":"^2.3.0","es-get-iterator":"^1.1.2","eslint":"^7.32.0","evalmd":"^0.0.19","for-each":"^0.3.3","nyc":"^10.3.2","object-inspect":"^1.11.0","safe-publish-latest":"^1.1.4","tape":"^5.3.1"},"auto-changelog":{"output":"CHANGELOG.md","template":"keepachangelog","unreleased":false,"commitLimit":false,"backfillLimit":false},"testling":{"files":"test/index.js"},"gitHead":"f9faae764cac92130015cf0cd0c214c468a3b32f","_id":"iterate-iterator@1.0.2","_nodeVersion":"16.10.0","_npmVersion":"7.24.0","dist":{"shasum":"551b804c9eaa15b847ea6a7cdc2f5bf1ec150f91","size":6254,"noattachment":false,"key":"/iterate-iterator/-/iterate-iterator-1.0.2.tgz","tarball":"http://registry.cnpm.dingdandao.com/iterate-iterator/download/iterate-iterator-1.0.2.tgz"},"_npmUser":{"name":"ljharb","email":"ljharb@gmail.com"},"directories":{},"maintainers":[{"name":"ljharb","email":""}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/iterate-iterator_1.0.2_1633125384533_0.16568454323155124"},"_hasShrinkwrap":false,"publish_time":1633125384652,"_cnpm_publish_time":1633125384652},"1.0.1":{"name":"iterate-iterator","version":"1.0.1","description":"Iterate any JS iterator. Works robustly in all environments, all versions.","main":"index.js","exports":{".":[{"default":"./index.js"},"./index.js"]},"scripts":{"prepublish":"safe-publish-latest","pretest":"npm run lint","prelint":"evalmd README.md","lint":"eslint .","tests-only":"node test","test":"npm run tests-only","coverage":"covert test","posttest":"npx aud","version":"auto-changelog && git add CHANGELOG.md","postversion":"auto-changelog && git add CHANGELOG.md && git commit --no-edit --amend && git tag -f \"v$(node -e \"console.log(require('./package.json').version)\")\""},"repository":{"type":"git","url":"git+https://github.com/ljharb/iterate-iterator.git"},"keywords":["iterate","iterator","iterable","es2015","es6","symbol.iterator","symbol","next"],"author":{"name":"Jordan Harband","email":"ljharb@gmail.com"},"license":"MIT","bugs":{"url":"https://github.com/ljharb/iterate-iterator/issues"},"homepage":"https://github.com/ljharb/iterate-iterator#readme","devDependencies":{"@ljharb/eslint-config":"^15.1.0","auto-changelog":"^1.16.2","covert":"^1.1.1","es-get-iterator":"^1.0.2","eslint":"^6.8.0","evalmd":"^0.0.19","for-each":"^0.3.3","object-inspect":"^1.7.0","safe-publish-latest":"^1.1.4","tape":"^5.0.0-next.3"},"auto-changelog":{"output":"CHANGELOG.md","template":"keepachangelog","unreleased":false,"commitLimit":false,"backfillLimit":false},"gitHead":"26356f7aafe05c44c581ffb470bbd403b46d8681","_id":"iterate-iterator@1.0.1","_nodeVersion":"13.6.0","_npmVersion":"6.13.4","dist":{"shasum":"1693a768c1ddd79c969051459453f082fe82e9f6","size":5162,"noattachment":false,"key":"/iterate-iterator/-/iterate-iterator-1.0.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/iterate-iterator/download/iterate-iterator-1.0.1.tgz"},"maintainers":[{"name":"ljharb","email":""}],"_npmUser":{"name":"ljharb","email":"ljharb@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/iterate-iterator_1.0.1_1579338267702_0.8958075273946788"},"_hasShrinkwrap":false,"publish_time":1579338267823,"_cnpm_publish_time":1579338267823},"1.0.0":{"name":"iterate-iterator","version":"1.0.0","description":"Iterate any JS iterator. Works robustly in all environments, all versions.","main":"index.js","scripts":{"prepublish":"safe-publish-latest","pretest":"npm run lint","prelint":"evalmd README.md","lint":"eslint .","tests-only":"node test","test":"npm run tests-only","coverage":"covert test","posttest":"npx aud","version":"auto-changelog && git add CHANGELOG.md","postversion":"auto-changelog && git add CHANGELOG.md && git commit --no-edit --amend && git tag -f \"v$(node -e \"console.log(require('./package.json').version)\")\""},"repository":{"type":"git","url":"git+https://github.com/ljharb/iterate-iterator.git"},"keywords":["iterate","iterator","iterable","es2015","es6","symbol.iterator","symbol","next"],"author":{"name":"Jordan Harband","email":"ljharb@gmail.com"},"license":"MIT","bugs":{"url":"https://github.com/ljharb/iterate-iterator/issues"},"homepage":"https://github.com/ljharb/iterate-iterator#readme","devDependencies":{"@ljharb/eslint-config":"^15.1.0","auto-changelog":"^1.16.2","covert":"^1.1.1","es-get-iterator":"^1.0.2","eslint":"^6.8.0","evalmd":"^0.0.19","for-each":"^0.3.3","object-inspect":"^1.7.0","safe-publish-latest":"^1.1.4","tape":"^5.0.0-next.3"},"auto-changelog":{"output":"CHANGELOG.md","template":"keepachangelog","unreleased":false,"commitLimit":false,"backfillLimit":false},"gitHead":"ae15c550d6efc2894fe5a1de0568030dc9c268fe","_id":"iterate-iterator@1.0.0","_nodeVersion":"13.6.0","_npmVersion":"6.13.4","dist":{"shasum":"64a75c3636c9ce8e2345d69f75d775c99bde556c","size":4740,"noattachment":false,"key":"/iterate-iterator/-/iterate-iterator-1.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/iterate-iterator/download/iterate-iterator-1.0.0.tgz"},"maintainers":[{"name":"ljharb","email":""}],"_npmUser":{"name":"ljharb","email":"ljharb@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/iterate-iterator_1.0.0_1579337923143_0.9694327609752997"},"_hasShrinkwrap":false,"publish_time":1579337923385,"_cnpm_publish_time":1579337923385}},"readme":"# iterate-iterator <sup>[![Version Badge][npm-version-svg]][package-url]</sup>\n\n[![github actions][actions-image]][actions-url]\n[![coverage][codecov-image]][codecov-url]\n[![dependency status][deps-svg]][deps-url]\n[![dev dependency status][dev-deps-svg]][dev-deps-url]\n[![License][license-image]][license-url]\n[![Downloads][downloads-image]][downloads-url]\n\n[![npm badge][npm-badge-png]][package-url]\n\nIterate any iterable JS iterator. Works robustly in all environments, all versions.\n\nIn modern engines, `[...value]` or `Array.from(value)` or `for (const item of value) { }` are sufficient to iterate an iterable value (an object with a `Symbol.iterator` method), which includes all builtin iterators. However, older engines:\n - may lack `Symbol`, array spread, or `for..of` support altogether\n - may have `Symbol.iterator` but not implement it on everything it should, like arguments objects\n - may have `Map` and `Set`, but a non-standard name for the iterator-producing method (`.iterator` or `['@@iterator']`, eg) and no syntax to support it\n - may be old versions of Firefox that produce values until they throw a StopIteration exception, rather than having iteration result objects\n - may be polyfilled/shimmed/shammed, with `es6-shim` or `core-js` or similar\n\nThis library simplifies iterating an iterator object, so no loops are required.\n\nIf called with a single iterator, it will return an array of the yielded values. If also called with a callback function, it will instead call that callback once for each yielded value.\n\n## Example\n\n```js\nvar iterate = require('iterate-iterator');\nvar getIterator = require('es-get-iterator');\nvar assert = require('assert');\n\nassert.deepEqual(iterate(getIterator('a ????')), ['a', ' ', '????']);\nassert.deepEqual(iterate(getIterator([1, 2])), [1, 2]);\nassert.deepEqual(iterate(getIterator(new Set([1, 2]))), [1, 2]);\nassert.deepEqual(iterate(getIterator(new Map([[1, 2], [3, 4]]))), [[1, 2], [3, 4]]);\n\nfunction assertWithCallback(iterable, expected) {\n\tvar values = [];\n\tvar callback = function (x) { values.push(x); };\n\titerate(iterable, callback);\n\tassert.deepEqual(values, expected);\n}\nassertWithCallback(getIterator('a ????'), ['a', ' ', '????']);\nassertWithCallback(getIterator([1, 2]), [1, 2]);\nassertWithCallback(getIterator(new Set([1, 2])), [1, 2]);\nassertWithCallback(getIterator(new Map([[1, 2], [3, 4]])), [[1, 2], [3, 4]]);\n```\n\n## Tests\nSimply clone the repo, `npm install`, and run `npm test`\n\n[package-url]: https://npmjs.org/package/iterate-iterator\n[npm-version-svg]: https://versionbadg.es/ljharb/iterate-iterator.svg\n[deps-svg]: https://david-dm.org/ljharb/iterate-iterator.svg\n[deps-url]: https://david-dm.org/ljharb/iterate-iterator\n[dev-deps-svg]: https://david-dm.org/ljharb/iterate-iterator/dev-status.svg\n[dev-deps-url]: https://david-dm.org/ljharb/iterate-iterator#info=devDependencies\n[npm-badge-png]: https://nodei.co/npm/iterate-iterator.png?downloads=true&stars=true\n[license-image]: https://img.shields.io/npm/l/iterate-iterator.svg\n[license-url]: LICENSE\n[downloads-image]: https://img.shields.io/npm/dm/iterate-iterator.svg\n[downloads-url]: https://npm-stat.com/charts.html?package=iterate-iterator\n[codecov-image]: https://codecov.io/gh/ljharb/iterate-iterator/branch/main/graphs/badge.svg\n[codecov-url]: https://app.codecov.io/gh/ljharb/iterate-iterator/\n[actions-image]: https://img.shields.io/endpoint?url=https://github-actions-badge-u3jn4tfpocch.runkit.sh/ljharb/iterate-iterator\n[actions-url]: https://github.com/ljharb/iterate-iterator/actions\n","_attachments":{},"homepage":"https://github.com/ljharb/iterate-iterator#readme","bugs":{"url":"https://github.com/ljharb/iterate-iterator/issues"},"license":"MIT"}