mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-05-26 19:04:13 +08:00
New typings for readline-transform
This commit is contained in:
25
types/readline-transform/index.d.ts
vendored
Normal file
25
types/readline-transform/index.d.ts
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
// Type definitions for readline-transform 0.9
|
||||
// Project: https://github.com/tilfin/readline-transform
|
||||
// Definitions by: Piotr Roszatycki <https://github.com/dex4er>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference types="node" />
|
||||
|
||||
import { Transform, TransformOptions } from 'stream';
|
||||
|
||||
declare namespace ReadlineTransform {
|
||||
interface Options extends TransformOptions {
|
||||
/** line break matcher for str.split() (default: /\r?\n/) */
|
||||
breakMatcher?: RegExp;
|
||||
/** if content ends with line break, ignore last empty line (default: true) */
|
||||
ignoreEndOfBreak?: boolean;
|
||||
/** if line is empty string, skip it (default: false) */
|
||||
skipEmpty?: boolean;
|
||||
}
|
||||
}
|
||||
|
||||
declare class ReadlineTransform extends Transform {
|
||||
constructor(options?: ReadlineTransform.Options);
|
||||
}
|
||||
|
||||
export = ReadlineTransform;
|
||||
12
types/readline-transform/readline-transform-tests.ts
Normal file
12
types/readline-transform/readline-transform-tests.ts
Normal file
@@ -0,0 +1,12 @@
|
||||
import { PassThrough } from 'stream';
|
||||
import ReadlineTransform = require('readline-transform');
|
||||
|
||||
const readStream = new PassThrough();
|
||||
const transform = new ReadlineTransform({
|
||||
breakMatcher: /\n/,
|
||||
ignoreEndOfBreak: false,
|
||||
skipEmpty: true
|
||||
});
|
||||
const writeStream = new PassThrough({ objectMode: true });
|
||||
|
||||
readStream.pipe(transform).pipe(writeStream);
|
||||
23
types/readline-transform/tsconfig.json
Normal file
23
types/readline-transform/tsconfig.json
Normal file
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictFunctionTypes": true,
|
||||
"strictNullChecks": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"readline-transform-tests.ts"
|
||||
]
|
||||
}
|
||||
6
types/readline-transform/tslint.json
Normal file
6
types/readline-transform/tslint.json
Normal file
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"extends": "dtslint/dt.json",
|
||||
"rules": {
|
||||
"strict-export-declare-modifiers": false
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user