Skip to content

Commit

Permalink
Require Node.js 10
Browse files Browse the repository at this point in the history
  • Loading branch information
sindresorhus committed Aug 10, 2020
1 parent 5cf31ba commit 80165c1
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 15 deletions.
1 change: 0 additions & 1 deletion .travis.yml
Expand Up @@ -3,4 +3,3 @@ node_js:
- '14'
- '12'
- '10'
- '8'
3 changes: 0 additions & 3 deletions index.d.ts
Expand Up @@ -100,9 +100,6 @@ declare const getStream: {
): Promise<string[]>;

MaxBufferError: typeof MaxBufferErrorClass;

// TODO: Remove this for the next major release
default: typeof getStream;
};

export = getStream;
4 changes: 1 addition & 3 deletions index.js
Expand Up @@ -24,8 +24,8 @@ async function getStream(inputStream, options) {
};

const {maxBuffer} = options;

const stream = bufferStream(options);

await new Promise((resolve, reject) => {
const rejectPromise = error => {
// Don't retrieve an oversized buffer.
Expand Down Expand Up @@ -56,8 +56,6 @@ async function getStream(inputStream, options) {
}

module.exports = getStream;
// TODO: Remove this for the next major release
module.exports.default = getStream;
module.exports.buffer = (stream, options) => getStream(stream, {...options, encoding: 'buffer'});
module.exports.array = (stream, options) => getStream(stream, {...options, array: true});
module.exports.MaxBufferError = MaxBufferError;
6 changes: 3 additions & 3 deletions index.test-d.ts
Expand Up @@ -13,9 +13,9 @@ expectType<Promise<Buffer>>(getStream.buffer(stream));
expectType<Promise<Buffer>>(getStream.buffer(stream, {maxBuffer: 10}));
expectType<Promise<Buffer>>(getStream.buffer(stream, {encoding: 'utf8'}));

expectType<Promise<unknown>>(getStream.array(stream));
expectType<Promise<{}>>(getStream.array<{}>(stream));
expectType<Promise<unknown>>(getStream.array(stream, {maxBuffer: 10}));
expectType<Promise<unknown[]>>(getStream.array(stream));
expectType<Promise<{}[]>>(getStream.array<{}>(stream));
expectType<Promise<unknown[]>>(getStream.array(stream, {maxBuffer: 10}));
expectType<Promise<Buffer[]>>(getStream.array(stream, {encoding: 'buffer'}));
expectType<Promise<Buffer[]>>(
getStream.array(stream, {maxBuffer: 10, encoding: 'buffer'})
Expand Down
6 changes: 3 additions & 3 deletions package.json
Expand Up @@ -38,10 +38,10 @@
"object"
],
"devDependencies": {
"@types/node": "^12.0.7",
"ava": "^2.0.0",
"@types/node": "^14.0.27",
"ava": "^2.4.0",
"into-stream": "^5.0.0",
"tsd": "^0.7.2",
"tsd": "^0.13.1",
"xo": "^0.24.0"
}
}
4 changes: 2 additions & 2 deletions test.js
Expand Up @@ -7,8 +7,8 @@ import getStream from '.';

function makeSetup(intoStream) {
const setup = (streamDef, options) => getStream(intoStream(streamDef), options);
setup.array = (streamDef, opts) => getStream.array(intoStream(streamDef), opts);
setup.buffer = (streamDef, opts) => getStream.buffer(intoStream(streamDef), opts);
setup.array = (streamDef, options) => getStream.array(intoStream(streamDef), options);
setup.buffer = (streamDef, options) => getStream.buffer(intoStream(streamDef), options);
return setup;
}

Expand Down

0 comments on commit 80165c1

Please sign in to comment.