Skip to content

Commit

Permalink
Throw user-friendly error message on undefined input
Browse files Browse the repository at this point in the history
Fixes #23
  • Loading branch information
sindresorhus committed Nov 25, 2023
1 parent dda3441 commit d38670e
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 6 deletions.
4 changes: 0 additions & 4 deletions .github/funding.yml

This file was deleted.

4 changes: 2 additions & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ jobs:
- 18
- 16
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
- run: npm install
Expand Down
4 changes: 4 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@ import {Readable as ReadableStream} from 'node:stream';
import {Buffer} from 'node:buffer';

function baseIntoStream(isObjectMode, input) {
if (input === undefined || input === null) {
throw new TypeError('Input should not be undefined or null.');
}

async function * reader() {
let value = await input;

Expand Down
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
},
"type": "module",
"exports": "./index.js",
"types": "./index.d.ts",
"sideEffects": false,
"engines": {
"node": ">=16"
},
Expand Down

0 comments on commit d38670e

Please sign in to comment.