1
0
Fork 0
tt9/scripts/_printers.js
2024-04-13 12:50:59 +03:00

13 lines
360 B
JavaScript

exports.print = function(str) {
process.stdout.write(`${str}\n`);
};
exports.printError = function(str) {
process.stderr.write(`${str instanceof Error ? str.stack : str}\n`);
};
exports.printWordsWithFrequencies = function(words) {
if (Array.isArray(words)) {
words.forEach(w => exports.print(`${w.word}${w.frequency ? '\t' + w.frequency : ''}`));
}
}