it-goodbye
Advanced tools
Comparing version 4.0.0 to 4.0.1
import type { Duplex } from 'it-stream-types'; | ||
export declare function goodbye(stream: Duplex<Uint8Array, Uint8Array>, goodbye?: Uint8Array | string): Duplex<Uint8Array, Uint8Array, Promise<void>>; | ||
export declare function goodbye<TSinkReturn>(stream: Duplex<Uint8Array, Uint8Array, Promise<TSinkReturn>>, goodbye?: Uint8Array | string): Duplex<Uint8Array, Uint8Array, Promise<TSinkReturn>>; | ||
//# sourceMappingURL=index.d.ts.map |
{ | ||
"name": "it-goodbye", | ||
"description": "Add a goodbye handshake to a duplex async iterable", | ||
"version": "4.0.0", | ||
"version": "4.0.1", | ||
"type": "module", | ||
@@ -111,3 +111,3 @@ "types": "./dist/src/index.d.ts", | ||
"test": "aegir test -f ./dist/test", | ||
"test:chrome": "npm run test -- -t browser", | ||
"test:chrome": "npm run test -- -t browser --cov", | ||
"test:chrome-webworker": "npm run test -- -t webworker", | ||
@@ -137,4 +137,3 @@ "test:firefox": "npm run test -- -t browser -- --browser firefox", | ||
"muxrpc": "^6.4.2", | ||
"pull-stream": "^3.6.9", | ||
"streaming-iterables": "^6.0.0" | ||
"pull-stream": "^3.6.9" | ||
}, | ||
@@ -141,0 +140,0 @@ "author": "Alan Shaw", |
import { endable } from './endable.js' | ||
import { equals as uint8ArrayEquals } from 'uint8arrays/equals' | ||
import { fromString as uint8ArrayFromString } from 'uint8arrays/from-string' | ||
import type { Duplex } from 'it-stream-types' | ||
import type { Duplex, Source } from 'it-stream-types' | ||
export function goodbye (stream: Duplex<Uint8Array, Uint8Array>, goodbye?: Uint8Array | string) { | ||
export function goodbye <TSinkReturn> (stream: Duplex<Uint8Array, Uint8Array, Promise<TSinkReturn>>, goodbye?: Uint8Array | string) { | ||
let token: Uint8Array | ||
@@ -19,3 +19,3 @@ | ||
const output: Duplex<Uint8Array, Uint8Array, Promise<void>> = { | ||
const output: Duplex<Uint8Array, Uint8Array, Promise<TSinkReturn>> = { | ||
// when the source ends, | ||
@@ -25,3 +25,3 @@ // send the goodbye and then wait to receive | ||
source: e(stream.source), | ||
sink: async source => { | ||
sink: async (source: Source<Uint8Array>): Promise<TSinkReturn> => { | ||
return await stream.sink(async function * () { | ||
@@ -28,0 +28,0 @@ // when the goodbye is received, allow the source to end. |
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
12997
8
0