From 0be43406270a9fda71da5c2b8e8d2f549af041de Mon Sep 17 00:00:00 2001 From: Benjamin Gruenbaum Date: Sun, 23 Jan 2022 18:00:34 +0200 Subject: [PATCH] Apply suggestions from code review Co-authored-by: Mestery --- doc/api/stream.md | 3 +-- test/parallel/test-stream-reduce.js | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/doc/api/stream.md b/doc/api/stream.md index c1158ed3951e6d..eef7b389967ca9 100644 --- a/doc/api/stream.md +++ b/doc/api/stream.md @@ -2140,7 +2140,7 @@ added: v17.4.0 aborted. * Returns: {Promise} a promise for the final value of the reduction. -This method calls `fn` on each chunk of the stream in order passing it the +This method calls `fn` on each chunk of the stream in order passing it the result from the calculation on the previous element. It returns a promise for the final value of the reduction. @@ -2150,7 +2150,6 @@ initial value. If the stream is empty, the promise is rejected with a ```mjs import { Readable } from 'stream'; -import { createReadStream } from 'fs'; const ten = await Readable.from([1, 2, 3, 4]).reduce((previous, data) => { return previous + data; diff --git a/test/parallel/test-stream-reduce.js b/test/parallel/test-stream-reduce.js index 28bdd39fc6b2df..a5f9a00e27f7a1 100644 --- a/test/parallel/test-stream-reduce.js +++ b/test/parallel/test-stream-reduce.js @@ -105,5 +105,5 @@ function sum(p, c) { { // Test result is a Promise const result = Readable.from([1, 2, 3, 4, 5]).reduce(sum, 0); - assert.strictEqual(result instanceof Promise, true); + assert.ok(result instanceof Promise); }