-
-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor TypeScript definition to CommonJS compatible export (#5)
- Loading branch information
1 parent
eea277f
commit c49dcd0
Showing
4 changed files
with
30 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,27 @@ | ||
/// <reference types="node"/> | ||
import {Readable as ReadableStream} from 'stream'; | ||
|
||
/** | ||
* Convert a `string`/`Buffer`/`Uint8Array` to a [readable stream](https://nodejs.org/api/stream.html#stream_readable_streams). | ||
* | ||
* @param input - Value to convert to a stream. | ||
*/ | ||
export default function toReadableStream( | ||
input: string | Buffer | Uint8Array | ||
): ReadableStream; | ||
declare const toReadableStream: { | ||
/** | ||
Convert a `string`/`Buffer`/`Uint8Array` to a [readable stream](https://nodejs.org/api/stream.html#stream_readable_streams). | ||
@param input - Value to convert to a stream. | ||
@example | ||
``` | ||
import toReadableStream = require('to-readable-stream'); | ||
toReadableStream('🦄🌈').pipe(process.stdout); | ||
``` | ||
*/ | ||
(input: string | Buffer | Uint8Array): ReadableStream; | ||
|
||
// TODO: Remove this for the next major release, refactor the whole definition to: | ||
// declare function toReadableStream( | ||
// input: string | Buffer | Uint8Array | ||
// ): ReadableStream; | ||
// export = toReadableStream; | ||
default: typeof toReadableStream; | ||
}; | ||
|
||
export = toReadableStream; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters