Constructor
new InterviewQuestion(ports, optionsopt)
Creates an instance of InterviewQuestion.
Parameters:
Name | Type | Attributes | Default | Description | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
ports |
Object | Dependencies or external resources required. | ||||||||||||
options |
Object |
<optional> |
{} | Configuration options.
Properties
|
Methods
(async) execute(filteropt, amountopt, levelopt) → {Promise.<Array>}
Executes the main functionality of filtering and retrieving questions.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
filter |
string |
<optional> |
'all' | The filter type (e.g., 'all', 'top'). |
amount |
number |
<optional> |
0 | The number of questions to retrieve if filter is 'top'. |
level |
string | null |
<optional> |
null | The difficulty level of questions ('junior', 'middle', 'senior'). |
Throws:
-
If an invalid level or filter type is provided.
- Type
- Error
Returns:
The filtered list of questions.
- Type
- Promise.<Array>
getTopQuestions(amount, data) → {Array}
Retrieves the top N questions from the dataset.
Parameters:
Name | Type | Description |
---|---|---|
amount |
number | The number of questions to retrieve. |
data |
Array | The dataset to retrieve questions from. |
Throws:
-
If the amount is not a positive integer.
- Type
- Error
Returns:
The top N questions.
- Type
- Array
log(message)
Logs a message if verbose mode is enabled.
Parameters:
Name | Type | Description |
---|---|---|
message |
string | The message to log. |