Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@cosmjs/stream

Package Overview
Dependencies
Maintainers
2
Versions
105
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@cosmjs/stream - npm Package Compare versions

Comparing version 0.26.6 to 0.26.8

18

build/concat.spec.js

@@ -10,3 +10,3 @@ "use strict";

it("can concat 0 streams", (done) => {
const concatenatedStream = concat_1.concat();
const concatenatedStream = (0, concat_1.concat)();
const expected = [];

@@ -24,3 +24,3 @@ concatenatedStream.addListener({

const stream1 = xstream_1.Stream.of("1", "2", "3");
const concatenatedStream = concat_1.concat(stream1);
const concatenatedStream = (0, concat_1.concat)(stream1);
const expected = ["1", "2", "3"];

@@ -39,3 +39,3 @@ concatenatedStream.addListener({

const stream2 = xstream_1.Stream.of("a", "b", "c");
const concatenatedStream = concat_1.concat(stream1, stream2);
const concatenatedStream = (0, concat_1.concat)(stream1, stream2);
const expected = ["1", "2", "3", "a", "b", "c"];

@@ -55,3 +55,3 @@ concatenatedStream.addListener({

const stream3 = xstream_1.Stream.of("X", "Y", "Z");
const concatenatedStream = concat_1.concat(stream1, stream2, stream3);
const concatenatedStream = (0, concat_1.concat)(stream1, stream2, stream3);
const expected = ["1", "2", "3", "a", "b", "c", "X", "Y", "Z"];

@@ -70,3 +70,3 @@ concatenatedStream.addListener({

const stream2 = xstream_1.Stream.of("a", "b", "c");
const concatenatedStream = concat_1.concat(stream2, stream1);
const concatenatedStream = (0, concat_1.concat)(stream2, stream1);
const expected = ["a", "b", "c", "1", "2", "3"];

@@ -85,3 +85,3 @@ concatenatedStream.addListener({

const stream2 = xstream_1.Stream.periodic(50).take(2);
const concatenatedStream = concat_1.concat(stream1, stream2);
const concatenatedStream = (0, concat_1.concat)(stream1, stream2);
const expected = [0, 1, 2, 0, 1];

@@ -100,3 +100,3 @@ concatenatedStream.addListener({

const stream2 = xstream_1.Stream.of(30, 40, 50, 60);
const concatenatedStream = concat_1.concat(stream1, stream2);
const concatenatedStream = (0, concat_1.concat)(stream1, stream2);
const expected = [0, 1, 2, 30, 40, 50, 60];

@@ -116,3 +116,3 @@ concatenatedStream.addListener({

const stream2 = sourceStream.take(3);
const concatenatedStream = concat_1.concat(stream1, stream2);
const concatenatedStream = (0, concat_1.concat)(stream1, stream2);
const expected = [0, 1, 2, 0, 1, 2];

@@ -146,3 +146,3 @@ concatenatedStream.addListener({

const stream1 = xstream_1.Stream.create(loggingProducer);
const concatenatedStream = concat_1.concat(stream1);
const concatenatedStream = (0, concat_1.concat)(stream1);
const expected = ["event0", "event1", "event2", "event3", "event4", "event5"];

@@ -149,0 +149,0 @@ expect(producerActiveLog).toEqual([]);

@@ -7,3 +7,3 @@ "use strict";

it("can be created", () => {
const operand = dropduplicates_1.dropDuplicates((value) => `${value}`);
const operand = (0, dropduplicates_1.dropDuplicates)((value) => `${value}`);
expect(operand).toBeTruthy();

@@ -13,3 +13,3 @@ });

const instream = xstream_1.Stream.fromArray([0, 1, 2, 3]);
const operand = dropduplicates_1.dropDuplicates((value) => `${value}`);
const operand = (0, dropduplicates_1.dropDuplicates)((value) => `${value}`);
const events = new Array();

@@ -26,3 +26,3 @@ instream.compose(operand).subscribe({

const instream = xstream_1.Stream.fromArray([1, 2, 2, 3, 3, 3, 4, 4, 4, 4]);
const operand = dropduplicates_1.dropDuplicates((value) => `${value}`);
const operand = (0, dropduplicates_1.dropDuplicates)((value) => `${value}`);
const events = new Array();

@@ -39,3 +39,3 @@ instream.compose(operand).subscribe({

const instream = xstream_1.Stream.fromArray([1, 2, 3, 4, 3, 2, 1]);
const operand = dropduplicates_1.dropDuplicates((value) => `${value}`);
const operand = (0, dropduplicates_1.dropDuplicates)((value) => `${value}`);
const events = new Array();

@@ -54,3 +54,3 @@ instream.compose(operand).subscribe({

const valueToKey = (value) => `${value}`.charAt(0);
const operand = dropduplicates_1.dropDuplicates(valueToKey);
const operand = (0, dropduplicates_1.dropDuplicates)(valueToKey);
const events = new Array();

@@ -72,3 +72,3 @@ instream.compose(operand).subscribe({

]);
const operand = dropduplicates_1.dropDuplicates((value) => value.last);
const operand = (0, dropduplicates_1.dropDuplicates)((value) => value.last);
const events = new Array();

@@ -75,0 +75,0 @@ instream.compose(operand).subscribe({

@@ -0,3 +1,3 @@

export { concat } from "./concat";
export { DefaultValueProducer, DefaultValueProducerCallsbacks } from "./defaultvalueproducer";
export { concat } from "./concat";
export { dropDuplicates, SameTypeStreamOperator } from "./dropduplicates";

@@ -4,0 +4,0 @@ export { firstEvent, fromListPromise, toListPromise } from "./promise";

@@ -13,7 +13,7 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.ValueAndUpdates = exports.toListPromise = exports.fromListPromise = exports.firstEvent = exports.dropDuplicates = exports.concat = exports.DefaultValueProducer = void 0;
exports.ValueAndUpdates = exports.toListPromise = exports.fromListPromise = exports.firstEvent = exports.dropDuplicates = exports.DefaultValueProducer = exports.concat = void 0;
var concat_1 = require("./concat");
Object.defineProperty(exports, "concat", { enumerable: true, get: function () { return concat_1.concat; } });
var defaultvalueproducer_1 = require("./defaultvalueproducer");
Object.defineProperty(exports, "DefaultValueProducer", { enumerable: true, get: function () { return defaultvalueproducer_1.DefaultValueProducer; } });
var concat_1 = require("./concat");
Object.defineProperty(exports, "concat", { enumerable: true, get: function () { return concat_1.concat; } });
var dropduplicates_1 = require("./dropduplicates");

@@ -20,0 +20,0 @@ Object.defineProperty(exports, "dropDuplicates", { enumerable: true, get: function () { return dropduplicates_1.dropDuplicates; } });

@@ -15,5 +15,5 @@ "use strict";

const prom = Promise.resolve(input);
const stream = promise_1.fromListPromise(prom);
const stream = (0, promise_1.fromListPromise)(prom);
// materialize stream into a counter, and wait for stream to complete
const counter = reducer_1.countStream(stream);
const counter = (0, reducer_1.countStream)(stream);
await counter.finished();

@@ -24,4 +24,4 @@ expect(counter.value()).toEqual(input.length);

const inputPromise = Promise.resolve(new Uint8Array([0x00, 0x11, 0x22]));
const stream = promise_1.fromListPromise(inputPromise);
const reader = reducer_1.asArray(stream);
const stream = (0, promise_1.fromListPromise)(inputPromise);
const reader = (0, reducer_1.asArray)(stream);
await reader.finished();

@@ -35,4 +35,4 @@ expect(reader.value()).toEqual([0x00, 0x11, 0x22]);

});
const stream = promise_1.fromListPromise(inputPromise);
const reader = reducer_1.asArray(stream);
const stream = (0, promise_1.fromListPromise)(inputPromise);
const reader = (0, reducer_1.asArray)(stream);
await reader.finished();

@@ -44,5 +44,5 @@ expect(reader.value()).toEqual([1, 2, 3]);

const prom = Promise.resolve(input);
const stream = promise_1.fromListPromise(prom);
const stream = (0, promise_1.fromListPromise)(prom);
// materialize stream into an array, and wait for stream to complete
const read = reducer_1.asArray(stream);
const read = (0, reducer_1.asArray)(stream);
await read.finished();

@@ -54,19 +54,19 @@ expect(read.value()).toEqual(input);

it("works for simple stream with more events than count", async () => {
const events = await promise_1.toListPromise(xstream_1.Stream.fromArray([1, 6, 92, 2, 9]), 3);
const events = await (0, promise_1.toListPromise)(xstream_1.Stream.fromArray([1, 6, 92, 2, 9]), 3);
expect(events).toEqual([1, 6, 92]);
});
it("works for simple stream with equal events and count", async () => {
const events = await promise_1.toListPromise(xstream_1.Stream.fromArray([1, 6, 92, 2, 9]), 5);
const events = await (0, promise_1.toListPromise)(xstream_1.Stream.fromArray([1, 6, 92, 2, 9]), 5);
expect(events).toEqual([1, 6, 92, 2, 9]);
});
it("works for simple stream with zero count", async () => {
const events = await promise_1.toListPromise(xstream_1.Stream.fromArray([1, 6, 92, 2, 9]), 0);
const events = await (0, promise_1.toListPromise)(xstream_1.Stream.fromArray([1, 6, 92, 2, 9]), 0);
expect(events).toEqual([]);
});
it("works for empty stream with zero count", async () => {
const events = await promise_1.toListPromise(xstream_1.Stream.fromArray([]), 0);
const events = await (0, promise_1.toListPromise)(xstream_1.Stream.fromArray([]), 0);
expect(events).toEqual([]);
});
it("rejects for simple stream with less events than count", async () => {
await promise_1.toListPromise(xstream_1.Stream.fromArray([1, 6, 92]), 5)
await (0, promise_1.toListPromise)(xstream_1.Stream.fromArray([1, 6, 92]), 5)
.then(() => fail("must not resolve"))

@@ -91,3 +91,3 @@ .catch((error) => expect(error).toMatch(/stream completed before all events could be collected/i));

};
const events = await promise_1.toListPromise(xstream_1.Stream.create(producer), 3);
const events = await (0, promise_1.toListPromise)(xstream_1.Stream.create(producer), 3);
expect(events).toEqual([0, 1, 2]);

@@ -100,7 +100,7 @@ await oneTickLater();

it("works for simple stream with more events than count", async () => {
const event = await promise_1.firstEvent(xstream_1.Stream.fromArray([1, 6, 92, 2, 9]));
const event = await (0, promise_1.firstEvent)(xstream_1.Stream.fromArray([1, 6, 92, 2, 9]));
expect(event).toEqual(1);
});
it("rejects for stream with no events", async () => {
await promise_1.firstEvent(xstream_1.Stream.fromArray([]))
await (0, promise_1.firstEvent)(xstream_1.Stream.fromArray([]))
.then(() => fail("must not resolve"))

@@ -125,3 +125,3 @@ .catch((error) => expect(error).toMatch(/stream completed before all events could be collected/i));

};
const event = await promise_1.firstEvent(xstream_1.Stream.create(producer));
const event = await (0, promise_1.firstEvent)(xstream_1.Stream.create(producer));
expect(event).toEqual(0);

@@ -128,0 +128,0 @@ await oneTickLater();

@@ -9,7 +9,7 @@ "use strict";

const stream = xstream_1.Stream.fromArray(input);
const result = reducer_1.asArray(stream);
const result = (0, reducer_1.asArray)(stream);
await result.finished();
expect(result.value()).toEqual(input);
// also handle empty properly
const result2 = reducer_1.asArray(xstream_1.Stream.empty());
const result2 = (0, reducer_1.asArray)(xstream_1.Stream.empty());
await result2.finished();

@@ -21,7 +21,7 @@ expect(result2.value()).toEqual([]);

const stream = xstream_1.Stream.fromArray(input);
const result = reducer_1.countStream(stream);
const result = (0, reducer_1.countStream)(stream);
await result.finished();
expect(result.value()).toEqual(input.length);
// also handle empty properly
const result2 = reducer_1.countStream(xstream_1.Stream.empty());
const result2 = (0, reducer_1.countStream)(xstream_1.Stream.empty());
await result2.finished();

@@ -33,7 +33,7 @@ expect(result2.value()).toEqual(0);

const stream = xstream_1.Stream.fromArray(input);
const result = reducer_1.lastValue(stream);
const result = (0, reducer_1.lastValue)(stream);
await result.finished();
expect(result.value()).toEqual("something");
// also handle empty properly (undefined)
const result2 = reducer_1.lastValue(xstream_1.Stream.empty());
const result2 = (0, reducer_1.lastValue)(xstream_1.Stream.empty());
await result2.finished();

@@ -45,3 +45,3 @@ expect(result2.value()).toBeUndefined();

try {
const result = reducer_1.asArray(stream);
const result = (0, reducer_1.asArray)(stream);
await result.finished();

@@ -48,0 +48,0 @@ fail("This should have thrown an error");

{
"name": "@cosmjs/stream",
"version": "0.26.6",
"version": "0.26.8",
"description": "Utility functions for producing and consuming streams",

@@ -33,3 +33,3 @@ "contributors": [

"format-text": "prettier --write \"./*.md\"",
"test-node": "node --require esm jasmine-testrunner.js",
"test-node": "yarn node jasmine-testrunner.js",
"test-edge": "yarn pack-web && karma start --single-run --browsers Edge",

@@ -56,4 +56,4 @@ "test-firefox": "yarn pack-web && karma start --single-run --browsers Firefox",

"@types/node": "^15.0.1",
"@typescript-eslint/eslint-plugin": "^4.28",
"@typescript-eslint/parser": "^4.28",
"@typescript-eslint/eslint-plugin": "^5.13.0",
"@typescript-eslint/parser": "^5.13.0",
"eslint": "^7.5",

@@ -67,6 +67,5 @@ "eslint-config-prettier": "^8.3.0",

"glob": "^7.1.6",
"jasmine": "^3.8",
"jasmine-core": "^3.7.1",
"jasmine": "^3.99",
"jasmine-spec-reporter": "^6",
"karma": "^6.1.1",
"karma": "^6.3.14",
"karma-chrome-launcher": "^3.1.0",

@@ -81,4 +80,4 @@ "karma-firefox-launcher": "^2.1.0",

"ts-node": "^8",
"typedoc": "^0.21",
"typescript": "~4.3",
"typedoc": "^0.22",
"typescript": "~4.4",
"webpack": "^5.32.0",

@@ -85,0 +84,0 @@ "webpack-cli": "^4.6.0"

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc