From bd3b137455668434c60057c978f45df6b42b369b Mon Sep 17 00:00:00 2001 From: Bart van der Schoor Date: Thu, 19 Jun 2014 18:15:59 +0200 Subject: [PATCH] added definition for JSONStream --- JSONStream/JSONStream-tests.ts | 15 +++++++++++++++ JSONStream/JSONStream.d.ts | 22 ++++++++++++++++++++++ 2 files changed, 37 insertions(+) create mode 100644 JSONStream/JSONStream-tests.ts create mode 100644 JSONStream/JSONStream.d.ts diff --git a/JSONStream/JSONStream-tests.ts b/JSONStream/JSONStream-tests.ts new file mode 100644 index 000000000..ea7eb64ff --- /dev/null +++ b/JSONStream/JSONStream-tests.ts @@ -0,0 +1,15 @@ +/// + +import json = require('JSONStream'); + +var read: NodeJS.ReadableStream; +var write: NodeJS.WritableStream; + +read = read.pipe(json.parse('*')); +read = read.pipe(json.parse(['foo/*', 'bar/*'])); + +read = json.stringify(); +read = json.stringify('{', ',', '}'); + +read = json.stringifyObject(); +read = json.stringifyObject('{', ',', '}'); diff --git a/JSONStream/JSONStream.d.ts b/JSONStream/JSONStream.d.ts new file mode 100644 index 000000000..869f965f4 --- /dev/null +++ b/JSONStream/JSONStream.d.ts @@ -0,0 +1,22 @@ +// Type definitions for JSONStream v0.8.0 +// Project: http://github.com/dominictarr/JSONStream +// Definitions by: Bart van der Schoor +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// + +declare module 'JSONStream' { + + export interface Options { + recurse: boolean; + } + + export function parse(pattern: any): NodeJS.ReadWriteStream; + export function parse(patterns: any[]): NodeJS.ReadWriteStream; + + export function stringify(): NodeJS.ReadWriteStream; + export function stringify(open: string, sep: string, close: string): NodeJS.ReadWriteStream; + + export function stringifyObject(): NodeJS.ReadWriteStream; + export function stringifyObject(open: string, sep: string, close: string): NodeJS.ReadWriteStream; +}