If anyone encountered the QwO problem (with questions and options request), here are the solutions:
getGF.js:
First, open the file getGF.js, then change this line of code:
if (typeof element[4][0] !== 'undefined' || element[4][0] !== null) {
to:
if (element[4] !== null && typeof element[4][0] !== 'undefined') {
Then open helpers.js
helpers.js:
In the helpers.js file, find the line:
function printAllInConsole(arr, type) {
if (type === "onlyQ") {
arr.forEach((element, index) => {
console.log(Q.${index+1}, JSON.stringify(element,undefined,2))
console.log("")
console.log("------------------------------------------")
});
} else if (type === "qWithO") {
arr.forEach((element, index) => {
console.log(Q.${index+1}, JSON.stringify(element.q,undefined,2))
element.ops.forEach((el, index) => {
const letter = String.fromCharCode(index + 97)
console.log(${letter}),el)
})
console.log("")
console.log("------------------------------------------")
});
} else {
console.log("The array you passed is,", JSON.stringify(arr, undefined, 2))
console.log("Invalid type passed")
console.log("The types are:")
console.log("onlyQs -----> When the array has only Questions");
console.log("qWithO -----> When the array passed has Questions and options")
}
}
Replace it with:
function printAllInConsole(arr, type) {
if (!Array.isArray(arr)) {
console.log("The array you passed is not valid.");
return;
}
if (type === "onlyQ") {
arr.forEach((element, index) => {
console.log(`Q.${index+1}`, JSON.stringify(element, undefined, 2));
console.log("");
console.log("------------------------------------------");
});
} else if (type === "qWithO") {
arr.forEach((element, index) => {
console.log(`Q.${index+1}`, JSON.stringify(element.q, undefined, 2));
if (Array.isArray(element.ops)) {
element.ops.forEach((el, index) => {
if (Array.isArray(el)) {
el.forEach((opt, idx) => {
const letter = String.fromCharCode(idx + 97);
console.log(`${letter}) `, opt);
});
} else {
const letter = String.fromCharCode(index + 97);
console.log(`${letter}) `, el);
}
});
} else {
console.log("Options array is not valid.");
}
console.log("");
console.log("------------------------------------------");
});
} else {
console.log("Invalid type passed.");
console.log("The types are:");
console.log("onlyQs -----> When the array has only Questions");
console.log("qWithO -----> When the array passed has Questions and options");
}
}
That's it! You can now run the command "node getGF.js QwO"
btw I'm not sure what to do for Microsoft Forms.
I don't guarantee that this will help you specifically!
If anyone encountered the QwO problem (with questions and options request), here are the solutions: getGF.js: First, open the file getGF.js, then change this line of code:
if (typeof element[4][0] !== 'undefined' || element[4][0] !== null) {
to:
if (element[4] !== null && typeof element[4][0] !== 'undefined') {
Then open helpers.js
helpers.js: In the helpers.js file, find the line:
function convertArrytoIncVotes (arr) { const initialArray = arr; let qOV = []; qOV = initialArray.map(qObj => { let options = [] options = qObj.ops.forEach(opt => { return { option: opt, upVotes: 0, downVotes: 0, } }) return { q: qObj.q, ops: options } }) }
Replace it with:
function convertArrytoIncVotes (arr) { const initialArray = arr; let qOV = initialArray.map(qObj => { let options = qObj.ops.map(opt => { return { option: opt, upVotes: 0, downVotes: 0, } }); return { q: qObj.q, ops: options } }); return qOV; }
Then find this line of code:
function printAllInConsole(arr, type) { if (type === "onlyQ") { arr.forEach((element, index) => { console.log(
Q.${index+1}
, JSON.stringify(element,undefined,2)) console.log("") console.log("------------------------------------------") }); } else if (type === "qWithO") { arr.forEach((element, index) => { console.log(Q.${index+1}
, JSON.stringify(element.q,undefined,2)) element.ops.forEach((el, index) => { const letter = String.fromCharCode(index + 97) console.log(${letter})
,el) }) console.log("") console.log("------------------------------------------") }); } else { console.log("The array you passed is,", JSON.stringify(arr, undefined, 2)) console.log("Invalid type passed") console.log("The types are:") console.log("onlyQs -----> When the array has only Questions"); console.log("qWithO -----> When the array passed has Questions and options") } }Replace it with:
function printAllInConsole(arr, type) { if (!Array.isArray(arr)) { console.log("The array you passed is not valid."); return; }
}
That's it! You can now run the command "node getGF.js QwO"
btw I'm not sure what to do for Microsoft Forms.
I don't guarantee that this will help you specifically!