-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Converts all modules to typescript. There should be no API changes, but the modules are all now ESM-only. BREAKING CHANGE: all modules are now published as ESM-only
- Loading branch information
1 parent
b621056
commit f8a38bf
Showing
298 changed files
with
7,499 additions
and
3,134 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
version: 2 | ||
updates: | ||
- package-ecosystem: npm | ||
directory: "/" | ||
schedule: | ||
interval: daily | ||
time: "10:00" | ||
open-pull-requests-limit: 10 | ||
commit-message: | ||
prefix: "deps" | ||
prefix-development: "deps(dev)" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
name: Automerge | ||
on: [ pull_request ] | ||
|
||
jobs: | ||
automerge: | ||
uses: protocol/.github/.github/workflows/automerge.yml@master | ||
with: | ||
job: 'automerge' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,145 @@ | ||
name: test & maybe release | ||
on: | ||
push: | ||
branches: | ||
- master # with #262 - ${{{ github.default_branch }}} | ||
pull_request: | ||
branches: | ||
- master # with #262 - ${{{ github.default_branch }}} | ||
|
||
jobs: | ||
|
||
check: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions/setup-node@v3 | ||
with: | ||
node-version: lts/* | ||
- uses: ipfs/aegir/actions/cache-node-modules@master | ||
- run: npm run --if-present lint | ||
- run: npm run --if-present dep-check | ||
|
||
test-node: | ||
needs: check | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
matrix: | ||
os: [windows-latest, ubuntu-latest, macos-latest] | ||
node: [16] | ||
fail-fast: true | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions/setup-node@v3 | ||
with: | ||
node-version: ${{ matrix.node }} | ||
- uses: ipfs/aegir/actions/cache-node-modules@master | ||
- run: npm run --if-present test:node | ||
- uses: codecov/codecov-action@81cd2dc8148241f03f5839d295e000b8f761e378 # v3.1.0 | ||
with: | ||
flags: node | ||
|
||
test-chrome: | ||
needs: check | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions/setup-node@v3 | ||
with: | ||
node-version: lts/* | ||
- uses: ipfs/aegir/actions/cache-node-modules@master | ||
- run: npm run --if-present test:chrome | ||
- uses: codecov/codecov-action@81cd2dc8148241f03f5839d295e000b8f761e378 # v3.1.0 | ||
with: | ||
flags: chrome | ||
|
||
test-chrome-webworker: | ||
needs: check | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions/setup-node@v3 | ||
with: | ||
node-version: lts/* | ||
- uses: ipfs/aegir/actions/cache-node-modules@master | ||
- run: npm run --if-present test:chrome-webworker | ||
- uses: codecov/codecov-action@81cd2dc8148241f03f5839d295e000b8f761e378 # v3.1.0 | ||
with: | ||
flags: chrome-webworker | ||
|
||
test-firefox: | ||
needs: check | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions/setup-node@v3 | ||
with: | ||
node-version: lts/* | ||
- uses: ipfs/aegir/actions/cache-node-modules@master | ||
- run: npm run --if-present test:firefox | ||
- uses: codecov/codecov-action@81cd2dc8148241f03f5839d295e000b8f761e378 # v3.1.0 | ||
with: | ||
flags: firefox | ||
|
||
test-firefox-webworker: | ||
needs: check | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions/setup-node@v3 | ||
with: | ||
node-version: lts/* | ||
- uses: ipfs/aegir/actions/cache-node-modules@master | ||
- run: npm run --if-present test:firefox-webworker | ||
- uses: codecov/codecov-action@81cd2dc8148241f03f5839d295e000b8f761e378 # v3.1.0 | ||
with: | ||
flags: firefox-webworker | ||
|
||
test-electron-main: | ||
needs: check | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions/setup-node@v3 | ||
with: | ||
node-version: lts/* | ||
- uses: ipfs/aegir/actions/cache-node-modules@master | ||
- run: npx xvfb-maybe npm run --if-present test:electron-main | ||
- uses: codecov/codecov-action@81cd2dc8148241f03f5839d295e000b8f761e378 # v3.1.0 | ||
with: | ||
flags: electron-main | ||
|
||
test-electron-renderer: | ||
needs: check | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions/setup-node@v3 | ||
with: | ||
node-version: lts/* | ||
- uses: ipfs/aegir/actions/cache-node-modules@master | ||
- run: npx xvfb-maybe npm run --if-present test:electron-renderer | ||
- uses: codecov/codecov-action@81cd2dc8148241f03f5839d295e000b8f761e378 # v3.1.0 | ||
with: | ||
flags: electron-renderer | ||
|
||
release: | ||
needs: [test-node, test-chrome, test-chrome-webworker, test-firefox, test-firefox-webworker, test-electron-main, test-electron-renderer] | ||
runs-on: ubuntu-latest | ||
if: github.event_name == 'push' && github.ref == 'refs/heads/master' # with #262 - 'refs/heads/${{{ github.default_branch }}}' | ||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
- uses: actions/setup-node@v3 | ||
with: | ||
node-version: lts/* | ||
- uses: ipfs/aegir/actions/cache-node-modules@master | ||
- uses: ipfs/aegir/actions/docker-login@master | ||
with: | ||
docker-token: ${{ secrets.DOCKER_TOKEN }} | ||
docker-username: ${{ secrets.DOCKER_USERNAME }} | ||
- run: npm run --if-present release | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
This project is dual licensed under MIT and Apache-2.0. | ||
|
||
MIT: https://www.opensource.org/licenses/mit | ||
Apache-2.0: https://www.apache.org/licenses/license-2.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at | ||
|
||
http://www.apache.org/licenses/LICENSE-2.0 | ||
|
||
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
The MIT License (MIT) | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in | ||
all copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
THE SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,83 @@ | ||
# it | ||
|
||
Utility modules to make dealing with async iterators easier, some trivial, some not. | ||
|
||
* [blob-to-it](./packages/blob-to-it) Turn a Blob into an iterable | ||
* [browser-readablestream-to-it](./packages/browser-readablestream-to-it) Turn a browser ReadableStream into an iterable | ||
* [it-all](./packages/it-all) Collect the contents of an iterable into an array | ||
* [it-batch](./packages/it-batch) Batch up the contents of an iterable into arrays | ||
* [it-buffer-stream](./packages/it-buffer-stream) Creates an iterable of buffers | ||
* [it-drain](./packages/it-drain) Consume an iterable and ignore any output | ||
* [it-filter](./packages/it-filter) Skip some items in an iterable based on a filter function | ||
* [it-first](./packages/it-first) Return the first item in an iterable | ||
* [it-flat-batch](./packages/it-flat-batch) Take an iterable of variable length arrays and make them all the same length | ||
* [it-foreach](./packages/it-foreach) Invoke a function for every member of an iterable | ||
* [it-glob](./packages/it-glob) Glob matcher for file systems | ||
* [it-last](./packages/it-last) Return the last item in an iterable | ||
* [it-length](./packages/it-length) Consume an iterable and return its length | ||
* [it-map](./packages/it-map) Map the output of an iterable | ||
* [it-merge](./packages/it-merge) Treat multiple iterables as one | ||
* [it-multipart](./packages/it-multipart) Parse multipart message bodies as an iterable | ||
* [it-ndjson](./packages/it-ndjson) Parse multipart message bodies as an iterable | ||
* [it-parallel](./packages/it-parallel) Take an iterable of functions that return promises and run them in parallel up to a concurrency limit | ||
* [it-parallel-batch](./packages/it-parallel-batch) Take an iterable of functions that return promises and run them in parallel in batches | ||
* [it-peekable](./packages/it-peekable) Peek/push an iterable | ||
* [it-reduce](./packages/it-reduce) Reduce the output of an iterable | ||
* [it-skip](./packages/it-skip) Skip items at the start of an iterable | ||
* [it-sort](./packages/it-sort) Sort an iterable using a passed sort function | ||
* [it-split](./packages/it-split) Split an iterable of buffers by linebreaks | ||
* [it-take](./packages/it-take) Limit the number of items you want from an iterable | ||
* [it-to-browser-readablestream](./packages/it-to-browser-readablestream) Turns an iterable into a WhatWG [ReadableStream](https://developer.mozilla.org/en-US/docs/Web/API/ReadableStream) | ||
* [it-to-buffer](./packages/it-to-buffer) Takes an iterable of Buffers and concatenates them | ||
# it <!-- omit in toc --> | ||
|
||
[![codecov](https://img.shields.io/codecov/c/github/achingbrain/it.svg?style=flat-square)](https://codecov.io/gh/achingbrain/it) | ||
[![CI](https://img.shields.io/github/workflow/status/achingbrain/it/test%20&%20maybe%20release/master?style=flat-square)](https://github.com/achingbrain/it/actions/workflows/js-test-and-release.yml) | ||
|
||
> A collection of utilities for making working with iterables more bearable | ||
## Table of contents <!-- omit in toc --> | ||
|
||
- [Structure](#structure) | ||
- [License](#license) | ||
- [Contribute](#contribute) | ||
|
||
## Structure | ||
|
||
- [`/packages/blob-to-it`](./packages/blob-to-it) Turns a blob into an async iterator | ||
- [`/packages/browser-readablestream-to-it`](./packages/browser-readablestream-to-it) Turns a browser readble stream into an async iterator | ||
- [`/packages/it-all`](./packages/it-all) Collects all values from an (async) iterable and returns them as an array | ||
- [`/packages/it-batch`](./packages/it-batch) Takes an async iterator that emits things and emits them as fixed size batches | ||
- [`/packages/it-buffer-stream`](./packages/it-buffer-stream) An async iterator that emits buffers containing bytes up to a certain length | ||
- [`/packages/it-drain`](./packages/it-drain) Empties an async iterator | ||
- [`/packages/it-filter`](./packages/it-filter) Filters the passed iterable by using the filter function | ||
- [`/packages/it-first`](./packages/it-first) Returns the first result from an async iterator | ||
- [`/packages/it-flat-batch`](./packages/it-flat-batch) Takes an async iterator that emits variable length arrays and emits them as fixed size batches | ||
- [`/packages/it-foreach`](./packages/it-foreach) Invokes the passed function for each item in an iterable | ||
- [`/packages/it-glob`](./packages/it-glob) Async iterable filename pattern matcher | ||
- [`/packages/it-last`](./packages/it-last) Returns the last result from an async iterator | ||
- [`/packages/it-length`](./packages/it-length) Counts the number of items in an async iterable | ||
- [`/packages/it-map`](./packages/it-map) Maps the values yielded by an async iterator | ||
- [`/packages/it-merge`](./packages/it-merge) Treat one or more iterables as a single iterable | ||
- [`/packages/it-multipart`](./packages/it-multipart) Async iterable http multipart message parser | ||
- [`/packages/it-ndjson`](./packages/it-ndjson) Parse iterators as ndjson and transform iterators to ndjson | ||
- [`/packages/it-parallel`](./packages/it-parallel) Takes an (async) iterable that emits promise-returning functions, invokes them in parallel up to the concurrency limit and emits the results as they become available, optionally in the same order as the input | ||
- [`/packages/it-parallel-batch`](./packages/it-parallel-batch) Takes an async iterator that emits promise-returning functions, invokes them in parallel and emits the results in the same order as the input | ||
- [`/packages/it-peekable`](./packages/it-peekable) Allows peeking/pushing an iterable | ||
- [`/packages/it-reduce`](./packages/it-reduce) Reduces the values yielded from an async iterator | ||
- [`/packages/it-skip`](./packages/it-skip) Skip items from an iterable | ||
- [`/packages/it-sort`](./packages/it-sort) Collects all values from an async iterator, sorts them using the passed function and yields them | ||
- [`/packages/it-split`](./packages/it-split) Splits Uint8Arrays emitted by an (async) iterable by a delimiter | ||
- [`/packages/it-take`](./packages/it-take) Stop iteration after n items have been received | ||
- [`/packages/it-to-browser-readablestream`](./packages/it-to-browser-readablestream) Takes an async iterator and turns it into a browser readable stream | ||
- [`/packages/it-to-buffer`](./packages/it-to-buffer) Takes an async iterator that yields buffers and concatenates them all together | ||
|
||
<!----> | ||
|
||
- [blob-to-it](./packages/blob-to-it) Turn a Blob into an iterable | ||
- [browser-readablestream-to-it](./packages/browser-readablestream-to-it) Turn a browser ReadableStream into an iterable | ||
- [it-all](./packages/it-all) Collect the contents of an iterable into an array | ||
- [it-batch](./packages/it-batch) Batch up the contents of an iterable into arrays | ||
- [it-buffer-stream](./packages/it-buffer-stream) Creates an iterable of buffers | ||
- [it-drain](./packages/it-drain) Consume an iterable and ignore any output | ||
- [it-filter](./packages/it-filter) Skip some items in an iterable based on a filter function | ||
- [it-first](./packages/it-first) Return the first item in an iterable | ||
- [it-flat-batch](./packages/it-flat-batch) Take an iterable of variable length arrays and make them all the same length | ||
- [it-foreach](./packages/it-foreach) Invoke a function for every member of an iterable | ||
- [it-glob](./packages/it-glob) Glob matcher for file systems | ||
- [it-last](./packages/it-last) Return the last item in an iterable | ||
- [it-length](./packages/it-length) Consume an iterable and return its length | ||
- [it-map](./packages/it-map) Map the output of an iterable | ||
- [it-merge](./packages/it-merge) Treat multiple iterables as one | ||
- [it-multipart](./packages/it-multipart) Parse multipart message bodies as an iterable | ||
- [it-ndjson](./packages/it-ndjson) Parse multipart message bodies as an iterable | ||
- [it-parallel](./packages/it-parallel) Take an iterable of functions that return promises and run them in parallel up to a concurrency limit | ||
- [it-parallel-batch](./packages/it-parallel-batch) Take an iterable of functions that return promises and run them in parallel in batches | ||
- [it-peekable](./packages/it-peekable) Peek/push an iterable | ||
- [it-reduce](./packages/it-reduce) Reduce the output of an iterable | ||
- [it-skip](./packages/it-skip) Skip items at the start of an iterable | ||
- [it-sort](./packages/it-sort) Sort an iterable using a passed sort function | ||
- [it-split](./packages/it-split) Split an iterable of buffers by linebreaks | ||
- [it-take](./packages/it-take) Limit the number of items you want from an iterable | ||
- [it-to-browser-readablestream](./packages/it-to-browser-readablestream) Turns an iterable into a WhatWG [ReadableStream](https://developer.mozilla.org/en-US/docs/Web/API/ReadableStream) | ||
- [it-to-buffer](./packages/it-to-buffer) Takes an iterable of Buffers and concatenates them | ||
|
||
## License | ||
|
||
Licensed under either of | ||
|
||
- Apache 2.0, ([LICENSE-APACHE](LICENSE-APACHE) / <http://www.apache.org/licenses/LICENSE-2.0>) | ||
- MIT ([LICENSE-MIT](LICENSE-MIT) / <http://opensource.org/licenses/MIT>) | ||
|
||
## Contribute | ||
|
||
Unless 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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,13 @@ | ||
{ | ||
"lerna": "2.9.0", | ||
"packages": [ | ||
"packages/*" | ||
], | ||
"lerna": "5.4.0", | ||
"useWorkspaces": true, | ||
"version": "independent", | ||
"command": { | ||
"bootstrap": { | ||
"hoist": true | ||
}, | ||
"run": { | ||
"stream": true | ||
} | ||
} | ||
}, | ||
"packages": [ | ||
"packages/*" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
This project is dual licensed under MIT and Apache-2.0. | ||
|
||
MIT: https://www.opensource.org/licenses/mit | ||
Apache-2.0: https://www.apache.org/licenses/license-2.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at | ||
|
||
http://www.apache.org/licenses/LICENSE-2.0 | ||
|
||
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. |
Oops, something went wrong.