@pnpm/logger
Version:
Logger for pnpm
18 lines • 582 B
JavaScript
// From https://www.npmjs.com/package/ndjson, but with updated deps, only parse and hardcoded options
import split from 'split2';
const opts = { strict: true };
export function parse() {
function parseRow(row) {
try {
if (row)
return JSON.parse(row);
}
catch (_e) {
if (opts.strict) {
this.emit('error', new Error(`Could not parse row "${row.length > 50 ? `${row.slice(0, 50)}...` : row}"`));
}
}
}
return split(parseRow, opts);
}
//# sourceMappingURL=ndjsonParse.js.map