Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // 1. select columns A and G from the Google Doc with the questions (category and title)
- // 2. paste into console as:
- var docsData = `
- ... text you copied
- `;
- // 3. run the code below, copy the printed result
- console.log(
- docsData.split('\n')
- .map(row => {
- let [category, questionText] = row.split('\t');
- category = category
- ?.trim()
- .replaceAll('&', 'and')
- .replaceAll(' ', '_')
- .toUpperCase();
- questionText = questionText?.trim();
- return questionText ? { category, questionText } : null;
- })
- .filter(Boolean)
- .map(r => `{ questionText: \`${r.questionText}\`, category: questionCategoriesEnum.${r.category} }`)
- .join(',\n')
- )
Advertisement
Add Comment
Please, Sign In to add comment