npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

quiz-trace-replay

v0.1.1

Published

Adaptive quiz selection with a replayable explanation for each decision.

Readme

Quiz Trace Replay

An adaptive quiz can make a sensible choice and still leave a teacher wondering why. This dependency-free Node.js library returns the question it selected, the reason for any difficulty change, and a replayable record. Give it the same bank, settings, and answer events to reproduce a completed or partial attempt.

Use it

Requires Node.js 22 or later. Once published, install it with npm install quiz-trace-replay. For a local preview, run npm pack in this folder and install the resulting tarball in a separate Node.js project.

const { createQuiz, replayQuiz } = require('quiz-trace-replay');

const settings = {
  seed: 'class-demo',
  limit: 1,
  questions: [{ id: 'a1', topic: 'Algebra', level: 2 }]
};

const quiz = createQuiz(settings);
const question = quiz.nextQuestion();
quiz.recordAnswer({ questionId: question.id, correct: true });

const report = quiz.report();
console.log(report.trail[0].reason); // HOLD
console.log(replayQuiz(settings, report.events).accuracy); // 100

How it works

  • Each topic starts with a proficiency of 50 and a target difficulty of Medium. Pass startingLevel to override the initial target.
  • The next item comes from the weakest topic with unused questions. Among candidates tied on proficiency, the closest difficulty to its topic's target wins. The seed and question position break remaining ties reproducibly. Levels are 1 (Easy), 2 (Medium), and 3 (Hard).
  • After grading, the new proficiency is 70% of the previous score plus 30 points for a correct answer, or zero additional points for an incorrect answer. Three consecutive correct answers raise the topic's target. Two incorrect answers in its most recent three lower it. The answer window clears when the target changes.
  • The report separates the target level from the item actually served. If a Hard item is unavailable, it can explain why an Easy or Medium item was used. A quiz can finish at the requested limit or when the bank runs out.

API

| Call | Returns | | --- | --- | | createQuiz({ questions, seed?, limit?, startingLevel? }) | An in-memory session. Each question needs a unique string id, string topic, and numeric level. | | quiz.nextQuestion() | The outstanding item and its selection details. Returns the same item until graded, or null at the end. | | quiz.recordAnswer({ questionId, correct }) | The graded item's trail entry. The app supplies the boolean grading outcome. | | quiz.report() | Status, counts, accuracy, ordered answer events, and the decision trail. | | replayQuiz(settings, events) | Reconstructed report. Throws if an event ID does not match what the selector expected. |

Keep the bank metadata, seed, starting level, limit, and package version alongside any saved events you plan to replay. A report describes the answered questions. The host application supplies prompts, checks answer keys, and handles persistence.

Run tests

Run npm test from this folder. The tests cover promotion, demotion, fallback, exhausted banks, repeated requests, invalid data, and deterministic replay. The separate demo project imports the package by name and grades real sample questions.