Skip to content

Commit bd3b137

Browse files
committed
added definition for JSONStream
1 parent 8c8e721 commit bd3b137

File tree

2 files changed

+37
-0
lines changed

2 files changed

+37
-0
lines changed

JSONStream/JSONStream-tests.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
/// <reference path="JSONStream.d.ts" />
2+
3+
import json = require('JSONStream');
4+
5+
var read: NodeJS.ReadableStream;
6+
var write: NodeJS.WritableStream;
7+
8+
read = read.pipe(json.parse('*'));
9+
read = read.pipe(json.parse(['foo/*', 'bar/*']));
10+
11+
read = json.stringify();
12+
read = json.stringify('{', ',', '}');
13+
14+
read = json.stringifyObject();
15+
read = json.stringifyObject('{', ',', '}');

JSONStream/JSONStream.d.ts

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
// Type definitions for JSONStream v0.8.0
2+
// Project: http://github.com/dominictarr/JSONStream
3+
// Definitions by: Bart van der Schoor <https://github.com/Bartvds>
4+
// Definitions: https://github.com/borisyankov/DefinitelyTyped
5+
6+
/// <reference path="../node/node.d.ts" />
7+
8+
declare module 'JSONStream' {
9+
10+
export interface Options {
11+
recurse: boolean;
12+
}
13+
14+
export function parse(pattern: any): NodeJS.ReadWriteStream;
15+
export function parse(patterns: any[]): NodeJS.ReadWriteStream;
16+
17+
export function stringify(): NodeJS.ReadWriteStream;
18+
export function stringify(open: string, sep: string, close: string): NodeJS.ReadWriteStream;
19+
20+
export function stringifyObject(): NodeJS.ReadWriteStream;
21+
export function stringifyObject(open: string, sep: string, close: string): NodeJS.ReadWriteStream;
22+
}

0 commit comments

Comments
 (0)