Skip to content

Commit e583174

Browse files
authored
fix!: do not create unnecessary async work (#66)
Crossing async boundaries is not free, so when this module is passed synchronous pipeline stages, do not wrap them in async generators to keep them synchronous. BREAKING CHANGE: when the entire pipeline is synchronous, the return value will now be synchronous
1 parent 0ea9837 commit e583174

File tree

5 files changed

+658
-157
lines changed

5 files changed

+658
-157
lines changed

.gitignore

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
node_modules
2-
coverage
3-
.nyc_output
4-
package-lock.json
2+
build
53
dist
4+
.docs
5+
.coverage
6+
node_modules
7+
package-lock.json
8+
yarn.lock
9+
.vscode

README.md

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,18 @@
11
# it-pipe <!-- omit in toc -->
22

33
[![codecov](https://img.shields.io/codecov/c/github/alanshaw/it-pipe.svg?style=flat-square)](https://codecov.io/gh/alanshaw/it-pipe)
4-
[![CI](https://img.shields.io/github/workflow/status/alanshaw/it-pipe/test%20&%20maybe%20release/master?style=flat-square)](https://github.com/alanshaw/it-pipe/actions/workflows/js-test-and-release.yml)
4+
[![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)
55

66
> Utility to "pipe" async iterables together
77
88
## Table of contents <!-- omit in toc -->
99

1010
- [Install](#install)
11+
- [Browser `<script>` tag](#browser-script-tag)
1112
- [Usage](#usage)
1213
- [API](#api)
1314
- [`pipe(firstFn, ...fns)`](#pipefirstfn-fns)
14-
- [Contribute](#contribute)
15+
- [API Docs](#api-docs)
1516
- [License](#license)
1617
- [Contribution](#contribution)
1718

@@ -21,6 +22,14 @@
2122
$ npm i it-pipe
2223
```
2324

25+
### Browser `<script>` tag
26+
27+
Loading this module through a script tag will make it's exports available as `ItPipe` in the global namespace.
28+
29+
```html
30+
<script src="https://unpkg.com/it-pipe/dist/index.min.js"></script>
31+
```
32+
2433
Based on this definition of streaming iterables <https://gist.github.com/alanshaw/591dc7dd54e4f99338a347ef568d6ee9>.
2534

2635
Almost 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.
@@ -65,9 +74,9 @@ Note:
6574
- `firstFn` may be a `Function` or an `Iterable`
6675
- `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`).
6776

68-
## Contribute
77+
## API Docs
6978

70-
Feel free to dive in! [Open an issue](https://github.com/alanshaw/it-pipe/issues/new) or submit PRs.
79+
- <https://alanshaw.github.io/it-pipe>
7180

7281
## License
7382

package.json

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
"types": "./dist/src/index.d.ts",
3232
"files": [
3333
"src",
34-
"dist/src",
34+
"dist",
3535
"!dist/test",
3636
"!**/*.tsbuildinfo"
3737
],
@@ -144,18 +144,20 @@
144144
"test:firefox-webworker": "aegir test -t webworker -- --browser firefox",
145145
"test:node": "aegir test -t node --cov",
146146
"test:electron-main": "aegir test -t electron-main",
147-
"release": "aegir release"
147+
"release": "aegir release",
148+
"docs": "aegir docs"
148149
},
149150
"dependencies": {
150-
"it-merge": "^2.0.0",
151-
"it-pushable": "^3.1.0",
152-
"it-stream-types": "^1.0.3"
151+
"it-merge": "^3.0.0",
152+
"it-pushable": "^3.1.0"
153153
},
154154
"devDependencies": {
155-
"aegir": "^37.4.8",
155+
"aegir": "^38.1.8",
156156
"delay": "^5.0.0",
157-
"it-all": "^2.0.0",
158-
"it-drain": "^2.0.0",
157+
"it-all": "^3.0.0",
158+
"it-drain": "^3.0.0",
159+
"it-map": "^3.0.0",
160+
"it-stream-types": "^1.0.3",
159161
"p-defer": "^4.0.0",
160162
"streaming-iterables": "^7.0.4"
161163
}

0 commit comments

Comments
 (0)