New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

questmap

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

questmap

exercise helper for webquest

latest
Source
npmnpm
Version
0.1.0
Version published
Maintainers
1
Created
Source

questmap

questmap is a simple helper library for writing webquest exercises.

Installation

npm install questmap

Usage

First, initialize an exercise and export it at the end:

const qm = require('questmap')

const exercise = qm()

module.exports = exercise

Then, you can add processors and such:

const qm = require('questmap')

const exercise = qm()

exercise.addVerifySetup(async function () {
  // setup here
})

exercise.addProcessor(async function () {
  // processing here
})

exercise.addRunCleanup(async function () {
  // cleanup here
})

module.exports = exercise

Exercise flow

There's three different stages which we can modify: setup, processor and cleanup. Although it's not required, it's recommended to use them in this way:

  • setup for setting up variables, objects and other things
  • processor to actually check and run exercises
  • cleanup to close connections, clean up variables and such

There's also three different versions of each, one that only runs when the exercise is in Verify mode, one for if it's in Run mode, or one that runs on both:

exercise.addProcessor()
exercise.addRunProcessor()
exercise.addVerifyProcessor()

NOTE: The function arguments to these functions HAVE to be async function (), NOT arrow functions.

Interacting with the exercise

The most important part of exercise verification and running is this. this keeps functions that let us interact with what the user sees, but also contains important contextual variables. Here's a list of what it contains:

this.log(MESSAGE)

Outputs an info message to the user.

this.error(MESSAGE)

Fails the exercise with MESSAGE.

this.end()

Ends the exercise run. If this.error() hasn't been called previously, passes the exercise. This doesn't need to be run, only if you want to end the exercise run early.

this.mode

Contains the mode, e.g. run or verify.

this.bus

Contains the nanobus instance used to talk to the user. It's not recommended to use this directly.

this.file

The path to the solution file passed in by the user.

this.context

The this object used by webquest itself.

Maintainers

This project is a community-owned and maintained project, meaning everyone takes part in caring for its wellbeing. Its current contributors are:

  • @pup (Olivia Hugger)

License

AGPL-3.0+ (see LICENSE)

Keywords

webquest

FAQs

Package last updated on 11 Jan 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts