it-stream-types
Advanced tools
Comparing version 1.0.4 to 1.0.5
@@ -0,8 +1,26 @@ | ||
/** | ||
* A "transform" is both a sink and a source where the values it consumes | ||
* and the values that can be consumed from it are connected in some way. | ||
* It is a function that takes a source and returns a source. | ||
*/ | ||
export interface Transform<A, B = A> { | ||
(source: Source<A>): Source<B>; | ||
} | ||
/** | ||
* A "sink" is something that consumes (or drains) a source. It is a | ||
* function that takes a source and iterates over it. It optionally returns | ||
* a value. | ||
*/ | ||
export interface Sink<T, R = Promise<void>> { | ||
(source: Source<T>): R; | ||
} | ||
export declare type Source<T> = AsyncIterable<T> | Iterable<T>; | ||
/** | ||
* A "source" is something that can be consumed. It is an iterable object. | ||
*/ | ||
export type Source<T> = AsyncIterable<T> | Iterable<T>; | ||
/** | ||
* A "duplex" is similar to a transform but the values it consumes are not | ||
* necessarily connected to the values that can be consumed from it. It is | ||
* an object with two properties, sink and source. | ||
*/ | ||
export interface Duplex<TSource, TSink = TSource, RSink = Promise<void>> { | ||
@@ -9,0 +27,0 @@ source: Source<TSource>; |
{ | ||
"name": "it-stream-types", | ||
"version": "1.0.4", | ||
"version": "1.0.5", | ||
"description": "Typescript types for AsyncIterable sink/source/duplex streams", | ||
"author": "Alex Potsides <alex@achingbrain.net>", | ||
"license": "Apache-2.0 OR MIT", | ||
"homepage": "https://github.com/achingbrain/it-stream-types#readme", | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/achingbrain/it-stream-types.git" | ||
}, | ||
"bugs": { | ||
"url": "https://github.com/achingbrain/it-stream-types/issues" | ||
}, | ||
"engines": { | ||
"node": ">=16.0.0", | ||
"npm": ">=7.0.0" | ||
}, | ||
"type": "module", | ||
@@ -9,3 +23,3 @@ "types": "./dist/src/index.d.ts", | ||
"src", | ||
"dist/src", | ||
"dist", | ||
"!dist/test", | ||
@@ -16,2 +30,3 @@ "!**/*.tsbuildinfo" | ||
".": { | ||
"types": "./dist/src/index.d.ts", | ||
"import": "./dist/src/index.js" | ||
@@ -53,11 +68,11 @@ } | ||
{ | ||
"type": "chore", | ||
"type": "docs", | ||
"release": "patch" | ||
}, | ||
{ | ||
"type": "docs", | ||
"type": "test", | ||
"release": "patch" | ||
}, | ||
{ | ||
"type": "test", | ||
"type": "deps", | ||
"release": "patch" | ||
@@ -92,5 +107,9 @@ }, | ||
"type": "docs", | ||
"section": "Trivial Changes" | ||
"section": "Documentation" | ||
}, | ||
{ | ||
"type": "deps", | ||
"section": "Dependencies" | ||
}, | ||
{ | ||
"type": "test", | ||
@@ -111,20 +130,10 @@ "section": "Tests" | ||
"lint": "aegir lint", | ||
"dep-check": "aegir dep-check dist/src/**/*.js dist/test/**/*.js", | ||
"build": "tsc", | ||
"release": "semantic-release" | ||
"dep-check": "aegir dep-check", | ||
"build": "aegir build", | ||
"release": "aegir release", | ||
"docs": "aegir docs" | ||
}, | ||
"author": "Alex Potsides <alex@achingbrain.net>", | ||
"license": "Apache-2.0 OR MIT", | ||
"devDependencies": { | ||
"aegir": "^36.1.3" | ||
}, | ||
"dependencies": {}, | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/achingbrain/it-stream-types.git" | ||
}, | ||
"bugs": { | ||
"url": "https://github.com/achingbrain/it-stream-types/issues" | ||
}, | ||
"homepage": "https://github.com/achingbrain/it-stream-types#readme" | ||
"aegir": "^37.7.8" | ||
} | ||
} |
@@ -1,13 +0,20 @@ | ||
# it-stream-types | ||
# it-stream-types <!-- omit in toc --> | ||
[![Build Status](https://github.com/achingbrain/it-stream-types/actions/workflows/main.yml/badge.svg?branch=master)](https://github.com/achingbrain/it-stream-types/actions/workflows/main.yml) | ||
[![Dependencies Status](https://david-dm.org/achingbrain/it-stream-types/status.svg)](https://david-dm.org/achingbrain/it-stream-types) | ||
[![JavaScript Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://standardjs.com) | ||
[![codecov](https://img.shields.io/codecov/c/github/achingbrain/it-stream-types.svg?style=flat-square)](https://codecov.io/gh/achingbrain/it-stream-types) | ||
[![CI](https://img.shields.io/github/actions/workflow/status/achingbrain/it-stream-types/js-test-and-release.yml?branch=master\&style=flat-square)](https://github.com/achingbrain/it-stream-types/actions/workflows/js-test-and-release.yml?query=branch%3Amaster) | ||
> Typescript types for AsyncIterable sink/source/duplex streams | ||
## Table of contents <!-- omit in toc --> | ||
- [Install](#install) | ||
- [Usage](#usage) | ||
- [API Docs](#api-docs) | ||
- [License](#license) | ||
- [Contribution](#contribution) | ||
## Install | ||
```sh | ||
npm i it-stream-types | ||
```console | ||
$ npm i it-stream-types | ||
``` | ||
@@ -23,8 +30,15 @@ | ||
## Contribute | ||
## API Docs | ||
Feel free to dive in! [Open an issue](https://github.com/achingbrain/it-stream-types/issues/new) or submit PRs. | ||
- <https://achingbrain.github.io/it-stream-types> | ||
## License | ||
[Apache 2.0](LICENSE-APACHE) or [MIT](LICENSE-MIT) | ||
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>) | ||
## Contribution | ||
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. |
@@ -0,1 +1,6 @@ | ||
/** | ||
* A "transform" is both a sink and a source where the values it consumes | ||
* and the values that can be consumed from it are connected in some way. | ||
* It is a function that takes a source and returns a source. | ||
*/ | ||
export interface Transform<A, B = A> { | ||
@@ -5,2 +10,7 @@ (source: Source<A>): Source<B> | ||
/** | ||
* A "sink" is something that consumes (or drains) a source. It is a | ||
* function that takes a source and iterates over it. It optionally returns | ||
* a value. | ||
*/ | ||
export interface Sink<T, R = Promise<void>> { | ||
@@ -10,4 +20,12 @@ (source: Source<T>): R | ||
/** | ||
* A "source" is something that can be consumed. It is an iterable object. | ||
*/ | ||
export type Source<T> = AsyncIterable<T> | Iterable<T> | ||
/** | ||
* A "duplex" is similar to a transform but the values it consumes are not | ||
* necessarily connected to the values that can be consumed from it. It is | ||
* an object with two properties, sink and source. | ||
*/ | ||
export interface Duplex<TSource, TSink = TSource, RSink = Promise<void>> { | ||
@@ -14,0 +32,0 @@ source: Source<TSource> |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
8441
10
68
44