UNPKG

interview-questions

Version:

A CLI tool for generating interview questions by difficulty level and quantity, with support for multiple output formats including text, JSON, and arrays.

988 lines (310 loc) 12.5 kB
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title>JSDoc: Class: InterviewQuestion</title> <script src="scripts/prettify/prettify.js"> </script> <script src="scripts/prettify/lang-css.js"> </script> <!--[if lt IE 9]> <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script> <![endif]--> <link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css"> <link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css"> </head> <body> <div id="main"> <h1 class="page-title">Class: InterviewQuestion</h1> <section> <header> <h2><span class="attribs"><span class="type-signature"></span></span>InterviewQuestion<span class="signature">(ports, options<span class="signature-attributes">opt</span>)</span><span class="type-signature"></span></h2> <div class="class-description">Class representing an InterviewQuestion handler.</div> </header> <article> <div class="container-overview"> <h2>Constructor</h2> <h4 class="name" id="InterviewQuestion"><span class="type-signature"></span>new InterviewQuestion<span class="signature">(ports, options<span class="signature-attributes">opt</span>)</span><span class="type-signature"></span></h4> <div class="description"> Creates an instance of InterviewQuestion. </div> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th>Attributes</th> <th>Default</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>ports</code></td> <td class="type"> <span class="param-type">Object</span> </td> <td class="attributes"> </td> <td class="default"> </td> <td class="description last">Dependencies or external resources required.</td> </tr> <tr> <td class="name"><code>options</code></td> <td class="type"> <span class="param-type">Object</span> </td> <td class="attributes"> &lt;optional><br> </td> <td class="default"> {} </td> <td class="description last">Configuration options. <h6>Properties</h6> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th>Attributes</th> <th>Default</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>verbose</code></td> <td class="type"> <span class="param-type">boolean</span> </td> <td class="attributes"> &lt;optional><br> </td> <td class="default"> false </td> <td class="description last">Enable verbose logging.</td> </tr> </tbody> </table> </td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="index.js.html">index.js</a>, <a href="index.js.html#line8">line 8</a> </li></ul></dd> </dl> </div> <h3 class="subsection-title">Methods</h3> <h4 class="name" id="execute"><span class="type-signature">(async) </span>execute<span class="signature">(filter<span class="signature-attributes">opt</span>, amount<span class="signature-attributes">opt</span>, level<span class="signature-attributes">opt</span>)</span><span class="type-signature"> &rarr; {Promise.&lt;Array>}</span></h4> <div class="description"> Executes the main functionality of filtering and retrieving questions. </div> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th>Attributes</th> <th>Default</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>filter</code></td> <td class="type"> <span class="param-type">string</span> </td> <td class="attributes"> &lt;optional><br> </td> <td class="default"> 'all' </td> <td class="description last">The filter type (e.g., 'all', 'top').</td> </tr> <tr> <td class="name"><code>amount</code></td> <td class="type"> <span class="param-type">number</span> </td> <td class="attributes"> &lt;optional><br> </td> <td class="default"> 0 </td> <td class="description last">The number of questions to retrieve if filter is 'top'.</td> </tr> <tr> <td class="name"><code>level</code></td> <td class="type"> <span class="param-type">string</span> | <span class="param-type">null</span> </td> <td class="attributes"> &lt;optional><br> </td> <td class="default"> null </td> <td class="description last">The difficulty level of questions ('junior', 'middle', 'senior').</td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="index.js.html">index.js</a>, <a href="index.js.html#line40">line 40</a> </li></ul></dd> </dl> <h5>Throws:</h5> <dl> <dt> <div class="param-desc"> If an invalid level or filter type is provided. </div> </dt> <dd></dd> <dt> <dl> <dt> Type </dt> <dd> <span class="param-type">Error</span> </dd> </dl> </dt> <dd></dd> </dl> <h5>Returns:</h5> <div class="param-desc"> The filtered list of questions. </div> <dl> <dt> Type </dt> <dd> <span class="param-type">Promise.&lt;Array></span> </dd> </dl> <h4 class="name" id="getTopQuestions"><span class="type-signature"></span>getTopQuestions<span class="signature">(amount, data)</span><span class="type-signature"> &rarr; {Array}</span></h4> <div class="description"> Retrieves the top N questions from the dataset. </div> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>amount</code></td> <td class="type"> <span class="param-type">number</span> </td> <td class="description last">The number of questions to retrieve.</td> </tr> <tr> <td class="name"><code>data</code></td> <td class="type"> <span class="param-type">Array</span> </td> <td class="description last">The dataset to retrieve questions from.</td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="index.js.html">index.js</a>, <a href="index.js.html#line69">line 69</a> </li></ul></dd> </dl> <h5>Throws:</h5> <dl> <dt> <div class="param-desc"> If the amount is not a positive integer. </div> </dt> <dd></dd> <dt> <dl> <dt> Type </dt> <dd> <span class="param-type">Error</span> </dd> </dl> </dt> <dd></dd> </dl> <h5>Returns:</h5> <div class="param-desc"> The top N questions. </div> <dl> <dt> Type </dt> <dd> <span class="param-type">Array</span> </dd> </dl> <h4 class="name" id="log"><span class="type-signature"></span>log<span class="signature">(message)</span><span class="type-signature"></span></h4> <div class="description"> Logs a message if verbose mode is enabled. </div> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>message</code></td> <td class="type"> <span class="param-type">string</span> </td> <td class="description last">The message to log.</td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="index.js.html">index.js</a>, <a href="index.js.html#line26">line 26</a> </li></ul></dd> </dl> </article> </section> </div> <nav> <h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="InterviewQuestion.html">InterviewQuestion</a></li></ul> </nav> <br class="clear"> <footer> Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 4.0.4</a> on Sat Dec 14 2024 18:03:31 GMT+0000 (Greenwich Mean Time) </footer> <script> prettyPrint(); </script> <script src="scripts/linenumber.js"> </script> </body> </html>