Add definition for split2 (#9692)

npm: https://www.npmjs.com/package/split2
project: https://github.com/mcollina/split2
This commit is contained in:
TANAKA Koichi
2016-06-19 12:32:02 +09:00
committed by Masahiro Wakame
parent 6ea0b792a0
commit 8ef38fbc56
2 changed files with 65 additions and 0 deletions

31
split2/split2-tests.ts Normal file
View File

@@ -0,0 +1,31 @@
/// <reference path="./split2.d.ts" />
/// <reference path="../node/node.d.ts" />
import * as split from 'split2';
import * as fs from 'fs';
import { Transform, TransformOptions } from 'stream';
let stream: Transform;
let options: split.Options = {};
let matcherString = '\t';
let matcherRegex = /\r?\n/;
stream = split();
stream = split(JSON.parse);
stream = split(options);
stream = split(JSON.parse, options);
stream = split(matcherString);
stream = split(matcherString, JSON.parse);
stream = split(matcherString, options);
stream = split(matcherString, JSON.parse, options);
stream = split(matcherRegex);
stream = split(matcherRegex, JSON.parse);
stream = split(matcherRegex, options);
stream = split(matcherRegex, JSON.parse, options);
options = {
maxLength: 1000,
objectMode: true,
highWaterMark: 16,
encoding: 'utf8'
};