interview-questions
Advanced tools
Comparing version 1.2.0 to 1.2.3
16
cli.js
@@ -13,2 +13,3 @@ #!/usr/bin/env node | ||
const format = args.format || 'text'; | ||
const theme = args.theme || ''; | ||
@@ -20,3 +21,4 @@ const logHeader = (header) => console.log('\x1b[32m%s\x1b[0m', header); | ||
console.log("--top ${amount}"); | ||
console.log("--level ( junior | middle | senior )"); | ||
console.log("--level ( basic | intermediate | advanced )"); | ||
console.log("--theme ( closures | storage | es6 | classes | database ... and other 203 themes)"); | ||
console.log("--format ( text | array | json )"); | ||
@@ -34,6 +36,11 @@ }; | ||
default: | ||
result.forEach(({ title, url }) => { | ||
result.forEach(({ title, url, text, theme }) => { | ||
console.log(''); | ||
logHeader(`Question: ${title}`); | ||
console.info(`Answer: \x1b]8;;${url}\x1b\\${url}\x1b]8;;\x1b\\`); | ||
if (url) { | ||
console.info(`Answer: \x1b]8;;${url}\x1b\\${url}\x1b]8;;\x1b\\`); | ||
} else { | ||
console.info(`Answer: ${text}`); | ||
} | ||
console.info(`Hash: ${theme.split(',').map((data) => ` #${data.trim().toLowerCase()}`)}`); | ||
logDivider(); | ||
@@ -52,6 +59,7 @@ }); | ||
const result = await interviewQuestion({ filter, amount, level, format }); | ||
const result = await interviewQuestion({ filter, amount, level, format, theme }); | ||
displayQuestions(result, format); | ||
console.log(''); | ||
console.log(`Found ${result.length} questions`); | ||
logExampleParams(); | ||
@@ -58,0 +66,0 @@ |
11
index.js
@@ -40,3 +40,3 @@ 'use strict'; | ||
*/ | ||
async execute(filter = 'all', amount = 0, level = null) { | ||
async execute(filter = 'all', amount = 0, level = null, theme = null) { | ||
let filteredData = this.data; | ||
@@ -53,2 +53,7 @@ | ||
// Filter by level if provided | ||
if (theme) { | ||
filteredData = filteredData.filter(item => item.theme.split(',').map((data) => data.trim().toLowerCase()).includes(theme)); | ||
} | ||
switch (filter) { | ||
@@ -94,4 +99,4 @@ case 'all': | ||
const interviewQuestion = new InterviewQuestion(options); | ||
const { filter = 'all', amount = 0, level = null } = options; | ||
return interviewQuestion.execute(filter, amount, level); | ||
const { filter = 'all', amount = 0, level = null, theme = null } = options; | ||
return interviewQuestion.execute(filter, amount, level, theme); | ||
}; |
{ | ||
"name": "interview-questions", | ||
"version": "1.2.0", | ||
"version": "1.2.3", | ||
"main": "index.js", | ||
@@ -5,0 +5,0 @@ "scripts": { |
Sorry, the diff of this file is too big to display
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
1627624
4848
1