Skip to content

Commit

Permalink
chore(json): remove redundant constructor examples (#5513)
Browse files Browse the repository at this point in the history
chore(json): remove constructor examples
  • Loading branch information
iuioiua authored Jul 23, 2024
1 parent 833544e commit 0945b9e
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 67 deletions.
16 changes: 0 additions & 16 deletions json/concatenated_json_parse_stream.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,22 +77,6 @@ export class ConcatenatedJsonParseStream

/**
* Constructs a new instance.
*
* @example Usage
* ```ts
* import { ConcatenatedJsonParseStream } from "@std/json/concatenated-json-parse-stream";
* import { assertEquals } from "@std/assert";
*
* const stream = ReadableStream.from([
* `{"foo":"bar"}`,
* `{"baz":100}`,
* ]).pipeThrough(new ConcatenatedJsonParseStream());
*
* assertEquals(await Array.fromAsync(stream), [
* { foo: "bar" },
* { baz: 100 },
* ]);
* ```
*/
constructor() {
const { writable, readable } = toTransformStream(
Expand Down
37 changes: 0 additions & 37 deletions json/parse_stream.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,43 +57,6 @@ function isBrankString(str: string) {
export class JsonParseStream extends TransformStream<string, JsonValue> {
/**
* Constructs new instance.
*
* @example Basic usage
*
* ```ts
* import { JsonParseStream } from "@std/json/parse-stream";
* import { assertEquals } from "@std/assert";
*
* const stream = ReadableStream.from([
* `{"foo":"bar"}`,
* `{"baz":100}`,
* ]).pipeThrough(new JsonParseStream());
*
* assertEquals(await Array.fromAsync(stream), [
* { foo: "bar" },
* { baz: 100 },
* ]);
* ```
*
* @example parse JSON lines or NDJSON from a file
* ```ts
* import { TextLineStream } from "@std/streams/text-line-stream";
* import { JsonParseStream } from "@std/json/parse-stream";
* import { assertEquals } from "@std/assert";
*
* const file = await Deno.open("json/testdata/test.jsonl");
*
* const readable = file.readable
* .pipeThrough(new TextDecoderStream()) // convert Uint8Array to string
* .pipeThrough(new TextLineStream()) // transform into a stream where each chunk is divided by a newline
* .pipeThrough(new JsonParseStream()); // parse each chunk as JSON
*
* assertEquals(await Array.fromAsync(readable), [
* {"hello": "world"},
* ["👋", "👋", "👋"],
* {"deno": "🦕"},
* ]);
* ```
*/
constructor() {
super(
Expand Down
14 changes: 0 additions & 14 deletions json/stringify_stream.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,20 +93,6 @@ export class JsonStringifyStream extends TransformStream<unknown, string> {
* Constructs new instance.
*
* @param options Options for the stream.
*
* @example Usage
* ```ts
* import { JsonStringifyStream } from "@std/json/stringify-stream";
* import { assertEquals } from "@std/assert";
*
* const stream = ReadableStream.from([{ foo: "bar" }, { baz: 100 }])
* .pipeThrough(new JsonStringifyStream());
*
* assertEquals(await Array.fromAsync(stream), [
* `{"foo":"bar"}\n`,
* `{"baz":100}\n`
* ]);
* ```
*/
constructor(options?: StringifyStreamOptions) {
const { prefix = "", suffix = "\n" } = options ?? {};
Expand Down

0 comments on commit 0945b9e

Please sign in to comment.