liudong
2023-05-29 340f156319b863525e50e900c58e59b86ecb3d5e
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
'use strict';
const split = require('split2');
const through = require('through2');
const pumpify = require('pumpify');
 
module.exports = (count, indent) => {
    if (!Number.isSafeInteger(count)) {
        throw new TypeError(`Expected \`count\` to be a integer, got \`${count}\` (${typeof count})`);
    }
 
    indent = typeof indent === 'string' ? indent : ' ';
 
    return pumpify(split(), through((data, enc, cb) => {
        cb(null, indent.repeat(count) + data + '\n');
    }));
};