Skip to content

Commit

Permalink
Minor readability tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
sindresorhus committed Mar 5, 2019
1 parent 95c7c2c commit ed04004
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 13 deletions.
4 changes: 2 additions & 2 deletions package.json
Expand Up @@ -57,7 +57,7 @@
"@types/duplexer3": "^0.1.0",
"@types/node": "^11.9.4",
"@types/p-cancelable": "^1.0.0",
"@typescript-eslint/eslint-plugin": "1.4.0",
"@typescript-eslint/eslint-plugin": "1.4.2",
"ava": "^1.1.0",
"coveralls": "^3.0.0",
"del-cli": "^1.1.0",
Expand All @@ -68,7 +68,7 @@
"nock": "^10.0.6",
"np": "^4.0.2",
"nyc": "^13.1.0",
"p-event": "^2.1.0",
"p-event": "^3.0.0",
"pem": "^1.14.1",
"proxyquire": "^2.0.1",
"sinon": "^7.2.2",
Expand Down
6 changes: 3 additions & 3 deletions source/as-stream.ts
@@ -1,13 +1,13 @@
import {ClientRequest} from 'http';
import {PassThrough} from 'stream';
import {PassThrough as PassThroughStream} from 'stream';
import duplexer3 from 'duplexer3';
import requestAsEventEmitter from './request-as-event-emitter';
import {HTTPError, ReadError} from './errors';
import {MergedOptions, Response} from './utils/types';

export default function asStream(options: MergedOptions) {
const input = new PassThrough();
const output = new PassThrough();
const input = new PassThroughStream();
const output = new PassThroughStream();
const proxy = duplexer3(input, output);
const piped = new Set();
let isFinished = false;
Expand Down
6 changes: 3 additions & 3 deletions source/progress.ts
@@ -1,12 +1,12 @@
import {Transform} from 'stream';
import {Transform as TransformStream} from 'stream';
import {EventEmitter} from 'events';
import {IncomingMessage, ClientRequest} from 'http';
import {Socket} from 'net';

export function download(_response: IncomingMessage, emitter: EventEmitter, downloadBodySize?: number): Transform {
export function download(_response: IncomingMessage, emitter: EventEmitter, downloadBodySize?: number): TransformStream {
let downloaded = 0;

return new Transform({
return new TransformStream({
transform(chunk, _encoding, callback) {
downloaded += chunk.length;

Expand Down
6 changes: 3 additions & 3 deletions test/cancel.js
@@ -1,5 +1,5 @@
import EventEmitter from 'events';
import {Readable} from 'stream';
import {Readable as ReadableStream} from 'stream';
import test from 'ava';
import pEvent from 'p-event';
import PCancelable from 'p-cancelable';
Expand Down Expand Up @@ -59,7 +59,7 @@ test('cancel do not retry after cancelation', async t => {

test('cancel in-progress request', async t => {
const helper = await createAbortServer();
const body = new Readable({
const body = new ReadableStream({
read() {}
});
body.push('1');
Expand All @@ -78,7 +78,7 @@ test('cancel in-progress request', async t => {

test('cancel in-progress request with timeout', async t => {
const helper = await createAbortServer();
const body = new Readable({
const body = new ReadableStream({
read() {}
});
body.push('1');
Expand Down
4 changes: 2 additions & 2 deletions test/promise.js
@@ -1,5 +1,5 @@
import {ClientRequest} from 'http';
import {Transform} from 'stream';
import {Transform as TransformStream} from 'stream';
import test from 'ava';
import got from '../source';
import {createServer} from './helpers/server';
Expand Down Expand Up @@ -27,7 +27,7 @@ test('should emit request event as promise', async t => {

test('should emit response event as promise', async t => {
await got(s.url).json().on('response', response => {
t.true(response instanceof Transform);
t.true(response instanceof TransformStream);
t.true(response.readable);
t.is(response.statusCode, 200);
});
Expand Down

0 comments on commit ed04004

Please sign in to comment.