mirror of
https://github.com/FlipsideCrypto/DefinitelyTyped.git
synced 2026-02-06 19:07:08 +00:00
split def. added
This commit is contained in:
parent
0acdbea7fd
commit
3c74c3686d
16
split/split-tests.ts
Normal file
16
split/split-tests.ts
Normal 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
17
split/split.d.ts
vendored
Normal 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;
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user