bootstrap-quiz-engine-manas
v1.0.0
Published
Reusable JavaScript quiz engine extracted from Manas Maydeo's Bootstrap 5 Mock Interview Quiz App.
Maintainers
Readme
bootstrap-quiz-engine-manas
A reusable JavaScript quiz engine extracted from the Bootstrap 5 Mock Interview Quiz App by Manas Maydeo.
The original project contains the UI, Bootstrap styling, question bank, timers, localStorage, and application routing. This package isolates the reusable quiz logic so it can be consumed by another JavaScript application.
Installation
npm install bootstrap-quiz-engine-manasUsage
import {
QuizEngine
} from "bootstrap-quiz-engine-manas";
import {
QUESTIONS_DATA,
CATEGORIES
} from "./questions.js";
const quiz = new QuizEngine({
questions: QUESTIONS_DATA,
categories: CATEGORIES
});
quiz.startQuiz("QUICK");
const question = quiz.getCurrentQuestion();
console.log(question);Submit an answer
const result = quiz.submitAnswer(1);
console.log(result.isCorrect);
console.log(result.correctAnswerText);
console.log(result.explanation);Move between questions
quiz.nextQuestion();
quiz.previousQuestion();Evaluate the quiz
const results = quiz.evaluateResults(95);
console.log(results.score);
console.log(results.total);
console.log(results.percentage);
console.log(results.tier.title);Built-in modes
QUICK— 10 questions / 10 minutesFULL— 30 questions / 15 minutesCOMPLETE— all supplied questions / untimed
Why the question bank is supplied by the consumer
The package is intentionally UI-independent and does not hard-code a DOM or browser storage implementation. Your existing Bootstrap Quiz App can continue to own questions.js, while other applications can supply their own question bank.
This makes the engine reusable for JavaScript, Vite, React, or other front-end projects.
Original project
GitHub: https://github.com/manasmaydeo8/Bootstrap-quiz-app
Local package tests
npm testPublishing
After logging in to npm:
npm login
npm publishBefore publishing, verify that the package name is available:
npm view bootstrap-quiz-engine-manasIf npm reports that the package does not exist, the name is available for your first publish.
