Skip to content

Commit 0a41bf0

Browse files
committed
Address review comments
- doc: do not use Unicode multiplication sign - doc: fix incorrect parameter name - zlib: remove `instanceof Buffer` - zlib: stylistic change - test: remove unneeded array spread - test: stylistic change
1 parent 874377b commit 0a41bf0

5 files changed

+7
-7
lines changed

doc/api/zlib.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -295,7 +295,7 @@ ignored by the decompression classes.
295295

296296
* `flush` {integer} (default: `zlib.constants.Z_NO_FLUSH`)
297297
* `finishFlush` {integer} (default: `zlib.constants.Z_FINISH`)
298-
* `chunkSize` {integer} (default: 16 × 1024)
298+
* `chunkSize` {integer} (default: 16\*1024)
299299
* `windowBits` {integer}
300300
* `level` {integer} (compression only)
301301
* `memLevel` {integer} (compression only)
@@ -627,7 +627,7 @@ changes:
627627
description: The `buffer` parameter can be an Uint8Array now.
628628
-->
629629

630-
- `buf` {Buffer|Uint8Array|string}
630+
- `buffer` {Buffer|Uint8Array|string}
631631

632632
Decompress a chunk of data with [Unzip][].
633633

lib/zlib.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -82,9 +82,9 @@ function zlibBuffer(engine, buffer, callback) {
8282
// Streams do not support non-Buffer Uint8Arrays yet. Convert it to a
8383
// Buffer without copying.
8484
if (isUint8Array(buffer) &&
85-
!(Object.getPrototypeOf(buffer) === Buffer.prototype ||
86-
buffer instanceof Buffer))
85+
Object.getPrototypeOf(buffer) !== Buffer.prototype) {
8786
buffer = Buffer.from(buffer.buffer, buffer.byteOffset, buffer.byteLength);
87+
}
8888

8989
var buffers = [];
9090
var nread = 0;

test/parallel/test-zlib-convenience-methods.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ const zlib = require('zlib');
2828

2929
const expectStr = 'blahblahblahblahblahblah';
3030
const expectBuf = Buffer.from(expectStr);
31-
const expectUint8Array = new Uint8Array([...expectBuf]);
31+
const expectUint8Array = new Uint8Array(expectBuf);
3232
const opts = {
3333
level: 9,
3434
chunkSize: 1024,

test/parallel/test-zlib-dictionary.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ const spdyDict = Buffer.from([
4141
'ation/xhtmltext/plainpublicmax-agecharset=iso-8859-1utf-8gzipdeflateHTTP/1',
4242
'.1statusversionurl\0'
4343
].join(''));
44-
const spdyDictUint8Array = new Uint8Array([...spdyDict]);
44+
const spdyDictUint8Array = new Uint8Array(spdyDict);
4545

4646
const input = [
4747
'HTTP/1.1 200 Ok',

test/parallel/test-zlib-not-string-or-buffer.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ const assert = require('assert');
88
const zlib = require('zlib');
99

1010
const expected =
11-
/^TypeError: "buffer" argument must be a string, Buffer, or Uint8Array$/;
11+
/^TypeError: "buffer" argument must be a string, Buffer, or Uint8Array$/;
1212

1313
assert.throws(() => { zlib.deflateSync(undefined); }, expected);
1414
assert.throws(() => { zlib.deflateSync(null); }, expected);

0 commit comments

Comments
 (0)