{"name":"it-pipe","version":"2.0.3","description":"Utility to \"pipe\" async iterables together","type":"module","types":"./dist/src/index.d.ts","exports":{".":{"import":"./dist/src/index.js"}},"eslintConfig":{"extends":"ipfs","parserOptions":{"sourceType":"module"}},"release":{"branches":["master"],"plugins":[["@semantic-release/commit-analyzer",{"preset":"conventionalcommits","releaseRules":[{"breaking":true,"release":"major"},{"revert":true,"release":"patch"},{"type":"feat","release":"minor"},{"type":"fix","release":"patch"},{"type":"chore","release":"patch"},{"type":"docs","release":"patch"},{"type":"test","release":"patch"},{"scope":"no-release","release":false}]}],["@semantic-release/release-notes-generator",{"preset":"conventionalcommits","presetConfig":{"types":[{"type":"feat","section":"Features"},{"type":"fix","section":"Bug Fixes"},{"type":"chore","section":"Trivial Changes"},{"type":"docs","section":"Trivial Changes"},{"type":"test","section":"Tests"}]}}],"@semantic-release/changelog","@semantic-release/npm","@semantic-release/github","@semantic-release/git"]},"scripts":{"lint":"aegir lint","dep-check":"aegir dep-check dist/src/**/*.js dist/test/**/*.js","build":"tsc","pretest":"npm run build","test":"aegir test -f ./dist/test","test:chrome":"npm run test -- -t browser --cov","test:chrome-webworker":"npm run test -- -t webworker","test:firefox":"npm run test -- -t browser -- --browser firefox","test:firefox-webworker":"npm run test -- -t webworker -- --browser firefox","test:node":"npm run test -- -t node --cov","test:electron-main":"npm run test -- -t electron-main","release":"semantic-release"},"author":{"name":"Alan Shaw"},"license":"MIT","devDependencies":{"aegir":"^36.1.3","delay":"^5.0.0","it-all":"^1.0.6","it-drain":"^1.0.5","p-defer":"^4.0.0","streaming-iterables":"^6.0.0"},"dependencies":{"it-merge":"^1.0.4","it-pushable":"^2.0.0","it-stream-types":"^1.0.3"},"repository":{"type":"git","url":"git+https://github.com/alanshaw/it-pipe.git"},"bugs":{"url":"https://github.com/alanshaw/it-pipe/issues"},"homepage":"https://github.com/alanshaw/it-pipe#readme","keywords":["pipe","pipeline","iterable","iterator","async","await","stream","pump","pull"],"gitHead":"b2a3726cbe7affb9d694cee017ae61b96012f8bc","_id":"it-pipe@2.0.3","_nodeVersion":"16.13.2","_npmVersion":"7.24.2","dist":{"integrity":"sha512-1bfNC0v8yFDQu5KwZpHZrVO+nxOIEXfrobYtv55NXcsMfGu2SueMOCyCm63khejA+sCU0gLcRFQIfKWlBNNTGw==","shasum":"a2aedfa7fb859fbfd25b1e1aadb813fce703206c","tarball":"http://registry-npm.ywwl.com/it-pipe/download/it-pipe-2.0.3.tgz","fileCount":8,"unpackedSize":21847,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJh4qWGCRA9TVsSAnZWagAAziUP/AuSpx/JbdJSbRrnes2i\nrLi+E2hPv6ATRya7ArgbGa6Oz5A03YXHuBu7Kk9BQRAvFU30M9x9m/QWuYwQ\npLHP25CspGqdPyBePyLSMGtL299kLorrfK02IZXRcDghgXKze0RRZfUDFj5b\nSnOLHCO6ySSvWhJ1p8kO7mBnlLFlIS1A8fBrNyPySSCrlS7/dL1FG0+/c/L+\nbAs8pW8s7gNBhp7FQ7PbYyKCdvPkTfpDBTSb4nw6NgE3SPgxJyB0vPzD3MTR\n222PFvlpylCQDdJIAFSFF0XH2Azkpp9G/JVpPFXZ84FgUV/c7kIOBo0a6p9B\nsmG7fBvn7wMnnJ5ceIVo/O/p9iVATufELR8n2Oz9oS8n1iYBfcLBXmkK4PVQ\n4DIhGYHNMpOEgSiNClIAD6mVl+GCzWRvZMBcqaHo3X0toSCb2BPwEVk1uh95\n+FyM+wOuA/dlcW+bnc6LQHEo4kfMT6R3nSqwkLHm6A1FRQRWILVgjZ5WDbA4\n2n0LEIPZ4fvqnnwcSo5cZNL9TKcwBLAEHum1OTfNs/iPQxJq0ncHj32w0oii\n3CYU1E7izWwe72/fUqw5VGk7H8I+ZbRykvP6hFtIerVlcNL2MfALDoEriL57\nlwXpiv3J6K3SjCcGu1fvsCwrGqsJJco/BIl0FUJBqLTqs7o47x53ImNtQlEV\nL/uf\r\n=g3gg\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIEvOQknQT1q7eqaVSFS3Bqyz/aJ3Ru8gEN5bJj4cG0p7AiApfOEEq0w0h9VVBSoUikQBLYOTx5ZhjiP/+EO6w7MPVw=="}],"size":5255,"noattachment":false,"key":"/it-pipe/-/it-pipe-2.0.3.tgz"},"_npmUser":{"name":"alanshaw","email":"alan138@gmail.com"},"directories":{},"maintainers":[{"name":"achingbrain","email":"alex@achingbrain.net"},{"name":"alanshaw","email":"alan138@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/it-pipe_2.0.3_1642243462224_0.09601571448776403"},"_hasShrinkwrap":false,"readme":"# it-pipe <!-- omit in toc -->\n\n[![codecov](https://img.shields.io/codecov/c/github/alanshaw/it-pipe.svg?style=flat-square)](https://codecov.io/gh/alanshaw/it-pipe)\n[![CI](https://img.shields.io/github/actions/workflow/status/alanshaw/it-pipe/js-test-and-release.yml?branch=master\\&style=flat-square)](https://github.com/alanshaw/it-pipe/actions/workflows/js-test-and-release.yml?query=branch%3Amaster)\n\n> Utility to \"pipe\" async iterables together\n\n## Table of contents <!-- omit in toc -->\n\n- [Install](#install)\n  - [Browser `<script>` tag](#browser-script-tag)\n- [Usage](#usage)\n- [API](#api)\n  - [`pipe(firstFn, ...fns)`](#pipefirstfn-fns)\n- [API Docs](#api-docs)\n- [License](#license)\n- [Contribution](#contribution)\n\n## Install\n\n```console\n$ npm i it-pipe\n```\n\n### Browser `<script>` tag\n\nLoading this module through a script tag will make it's exports available as `ItPipe` in the global namespace.\n\n```html\n<script src=\"https://unpkg.com/it-pipe/dist/index.min.js\"></script>\n```\n\nBased on this definition of streaming iterables <https://gist.github.com/alanshaw/591dc7dd54e4f99338a347ef568d6ee9>.\n\nAlmost identical to the [`pipeline`](https://github.com/bustle/streaming-iterables#pipeline) function from the [`streaming-iterables`](https://www.npmjs.com/package/streaming-iterables) module except that it supports duplex streams *and* will automatically wrap a \"source\" as the first param in a function.\n\n## Usage\n\n```js\nimport { pipe } from 'it-pipe'\n\nconst result = await pipe(\n  // A source is just an iterable, this is shorthand for () => [1, 2, 3]\n  [1, 2, 3],\n  // A transform takes a source, and returns a source.\n  // This transform doubles each value asynchronously.\n  function transform (source) {\n    return (async function * () { // A generator is async iterable\n      for await (const val of source) yield val * 2\n    })()\n  },\n  // A sink, it takes a source and consumes it, optionally returning a value.\n  // This sink buffers up all the values from the source and returns them.\n  async function collect (source) {\n    const vals = []\n    for await (const val of source) {\n      vals.push(val)\n    }\n    return vals\n  }\n)\n\nconsole.log(result) // 2,4,6\n```\n\n## API\n\n### `pipe(firstFn, ...fns)`\n\nCalls `firstFn` and then every function in `fns` with the result of the previous function. The final return is the result of the last function in `fns`.\n\nNote:\n\n- `firstFn` may be a `Function` or an `Iterable`\n- `firstFn` or any of `fns` may be a [duplex object](https://gist.github.com/alanshaw/591dc7dd54e4f99338a347ef568d6ee9#duplex-it) (an object with a `sink` and `source`).\n\n## API Docs\n\n- <https://alanshaw.github.io/it-pipe>\n\n## License\n\nLicensed under either of\n\n- Apache 2.0, ([LICENSE-APACHE](LICENSE-APACHE) / <http://www.apache.org/licenses/LICENSE-2.0>)\n- MIT ([LICENSE-MIT](LICENSE-MIT) / <http://opensource.org/licenses/MIT>)\n\n## Contribution\n\nUnless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.\n","publish_time":1642243462400,"_cnpm_publish_time":1642243462400,"dist-tags":{"latest":"3.0.1"}}