DefinitelyTyped/types/through2-map/through2-map-tests.ts
2017-07-16 23:12:54 -07:00

36 lines
712 B
TypeScript

import stream = require('stream');
import map = require('through2-map');
const stripTags = map({wantStrings: true}, (str) => {
return str.replace(/<.*?>/g, "");
});
process.stdin.pipe(stripTags);
const truncate = map((chunk) => {
return chunk.slice(0, 10);
});
process.stdin.pipe(truncate);
const Ctor = map.ctor((chunk) => {
return chunk.slice(0, 10);
});
new Ctor();
new Ctor({ objectMode: true, allowHalfOpen: true });
const Obj = map.obj((chunk) => {
return chunk.slice(0, 10);
});
new Obj();
new Obj({ objectMode: true, allowHalfOpen: true });
const Objctor = map.objCtor((chunk) => {
return chunk.slice(0, 10);
});
new Objctor();
new Objctor({ objectMode: true, allowHalfOpen: true });