split def. added

This commit is contained in:
Marcin Porebski 2015-02-26 10:31:53 +01:00
parent 0acdbea7fd
commit 3c74c3686d
2 changed files with 33 additions and 0 deletions

16
split/split-tests.ts Normal file
View File

@ -0,0 +1,16 @@
/// <reference path="split.d.ts" />
/// <reference path="../node/node.d.ts" />
import stream = require("stream");
import split = require("split");
var testStream = new stream.Readable();
testStream.pipe = function(dest) {
dest.write("This is \r\n new \r\n line");
return dest;
};
testStream.pipe(split(/(\r?\n)/, null, {maxLength: 20})).on("data", function(line) {
console.log("Line: " + line + "\r\n");
});

17
split/split.d.ts vendored Normal file
View File

@ -0,0 +1,17 @@
// Type definitions for split v0.3.3
// Project: https://github.com/dominictarr/split
// Definitions by: Marcin Porębski <https://github.com/marcinporebski>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
/// <reference path="../node/node.d.ts" />
declare module "split" {
interface SplitOptions {
maxLength: number
}
function split(matcher?:any, mapper?:any, options?: SplitOptions):any;
export = split;
}