mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-04-24 05:06:02 +08:00
Add definition for split2 (#9692)
npm: https://www.npmjs.com/package/split2 project: https://github.com/mcollina/split2
This commit is contained in:
committed by
Masahiro Wakame
parent
6ea0b792a0
commit
8ef38fbc56
31
split2/split2-tests.ts
Normal file
31
split2/split2-tests.ts
Normal 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'
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user