Init
This commit is contained in:
22
utility/readPromise.js
Normal file
22
utility/readPromise.js
Normal file
@@ -0,0 +1,22 @@
|
||||
const rd = require('readline').createInterface(process.stdin,process.stdout)
|
||||
|
||||
|
||||
/**
|
||||
* Get an answer from a reply
|
||||
* @param {String} askQuestion
|
||||
* @returns {Promise<String>}
|
||||
*/
|
||||
module.exports.ask = (askQuestion)=>{
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
return new Promise((resolve,reject)=>{
|
||||
rd.question(askQuestion,answer=>{
|
||||
if(answer){
|
||||
resolve(answer)
|
||||
}
|
||||
// else{
|
||||
// reject(new Error("REE NO ANSWER"))
|
||||
// }
|
||||
})
|
||||
})
|
||||
}
|
||||
module.exports.close = ()=>(rd.close())
|
4
utility/webWorker.js
Normal file
4
utility/webWorker.js
Normal file
@@ -0,0 +1,4 @@
|
||||
|
||||
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
const workers = require('worker_threads')
|
11
utility/writeToMarkdown.js
Normal file
11
utility/writeToMarkdown.js
Normal file
@@ -0,0 +1,11 @@
|
||||
//@ts-check
|
||||
/**
|
||||
* @param {Array<{parts: number;count: number;person: String;}>} data
|
||||
*/
|
||||
module.exports = (data) => {
|
||||
let writable = "Name | Count | Parts\n --- | --- | ---\n"
|
||||
data.forEach(element => {
|
||||
writable += `${element.person} | ${element.count} | ${element.parts}\n`
|
||||
});
|
||||
require('fs').writeFileSync("output.md", writable)
|
||||
}
|
Reference in New Issue
Block a user