Giter VIP home page Giter VIP logo

animequiz's Introduction

Anime Quiz

Generate random anime quiz!

App Version Node License

Installation

npm i aniquiz

Usage

Generate random anime quiz

const animequiz = require('aniquiz')

// Random quiz object
console.log(animequiz.getEntry())

// Quiz object with difficulty
console.log(animequiz.getEntry({ difficulty: 'easy' }))

// Quiz object with image
console.log(animequiz.getEntry({ image: true })

// Quiz object without image
console.log(animequiz.getEntry({ image: false }))

Options

property type default
difficulty string none
image boolean none

Quiz object

Property type description
difficulty string The difficulty of the question
time number The time in ms the question should be answered
question string The question
answers array The array of possible answers
image string The image of the question, if applicable
submittedBy string The one created the question
id string The id of this question
custom boolean Whether this quiz object was manually added

Example response

Success

{
  difficulty: 'Hard',
  time: 20000,
  question: 'The name of Junko Enoshima’s imposter at the beginning of Danganronpa: Trigger Happy Havoc is?',
  answers: [ 'mukuro ikusaba', 'ikusaba mukuro' ],
  image: null,
  submittedBy: 'Sakurajimai',
  id: '111'
}

Error

{ error: 'error msg.' }

Create instance

Creating a quiz instance allows you to prevent receiving the same question twice

const { Quiz } = require('aniquiz');

// class parameters accepts options
const quiz = new Quiz({ difficulty: 'easy' })

// Quiz object
console.log(quiz.getEntry())

// Quiz entries
console.log(quiz.getEntries())

// Accepts options parameter as well

Error

If instance runs out of quiz entry, you encounter the following error

{ error: 'Exhausted entries.' }

You can reload entries by using

quiz.reload(options)

or add your own entries via

quiz.addEntries([])

Added entries will be appended with custom property which is set to true.

Total Entries: 132

animequiz's People

Contributors

maisans-maid avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.